class MCollective::WindowsDaemon
Public Class Methods
daemonize_runner(pid=nil)
click to toggle source
# File lib/mcollective/windows_daemon.rb 6 def self.daemonize_runner(pid=nil) 7 raise "Writing pid files are not supported on the Windows Platform" if pid 8 raise "The Windows Daemonizer should only be used on the Windows Platform" unless Util.windows? 9 10 WindowsDaemon.mainloop 11 end
Public Instance Methods
service_main()
click to toggle source
# File lib/mcollective/windows_daemon.rb 13 def service_main 14 Log.debug("Starting Windows Service Daemon") 15 16 @runner = Runner.new(nil) 17 @runner.main_loop 18 19 # On shut down there may be threads outside of the runner's context that are 20 # in a sleeping state, causing the stop action to wait for them to cleanly exit. 21 # We get around this by iterating the list of threads and killing everything that 22 # isn't the main thread, letting us shut down cleanly. 23 Thread.list.each do |t| 24 if t != Thread.current 25 t.kill 26 end 27 end 28 end
service_pause()
click to toggle source
# File lib/mcollective/windows_daemon.rb 35 def service_pause 36 Log.info("Pausing MCollective Windows server") 37 @runner.pause 38 end
service_resume()
click to toggle source
# File lib/mcollective/windows_daemon.rb 40 def service_resume 41 Log.info("Resuming MCollective Windows server") 42 @runner.resume 43 end
service_stop()
click to toggle source
# File lib/mcollective/windows_daemon.rb 30 def service_stop 31 Log.info("Windows service stopping") 32 @runner.stop 33 end