Update version according to OSCI-856
[packages/precise/mcollective.git] / lib / mcollective / windows_daemon.rb
1 require 'win32/daemon'
2
3 module MCollective
4   class WindowsDaemon < Win32::Daemon
5     def self.daemonize_runner(pid=nil)
6       raise "Writing pid files are not supported on the Windows Platform" if pid
7       raise "The Windows Daemonizer should only be used on the Windows Platform" unless Util.windows?
8
9       WindowsDaemon.mainloop
10     end
11
12     def service_main
13       Log.debug("Starting Windows Service Daemon")
14
15       while running?
16         Runner.new(nil).run
17       end
18     end
19
20     def service_stop
21       Log.info("Windows service stopping")
22     end
23   end
24 end