class DynDaemon
Public Instance Methods
service_init()
click to toggle source
# File bin/dyn-daemon, line 45 def service_init File.open(DYN_DAEMON_LOG_FILE, 'a'){ |f| f.puts "Initializing service #{Time.now}" } @server_pid = Process.spawn CMD, :chdir => DYN_DAEMON_DIR, :err => [DYN_DAEMON_LOG_FILE, 'a'] File.open(DYN_DAEMON_LOG_FILE, 'a'){ |f| f.puts @server_pid.inspect } end
service_main()
click to toggle source
# File bin/dyn-daemon, line 52 def service_main File.open(DYN_DAEMON_LOG_FILE, 'a'){ |f| f.puts "Service is running #{Time.now} with pid #{@server_pid}" } while running? sleep 10 end end
service_stop()
click to toggle source
# File bin/dyn-daemon, line 59 def service_stop File.open(DYN_DAEMON_LOG_FILE, 'a'){ |f| f.puts "Stopping server thread #{Time.now}" } system "taskkill /PID #{@server_pid} /T /F" Process.waitall File.open(DYN_DAEMON_LOG_FILE, 'a'){ |f| f.puts "Service stopped #{Time.now}" } exit! end