Daemonize the current process
# File lib/mcollective/unix_daemon.rb, line 4 4: def self.daemonize 5: fork do 6: Process.setsid 7: exit if fork 8: Dir.chdir('/tmp') 9: STDIN.reopen('/dev/null') 10: STDOUT.reopen('/dev/null', 'a') 11: STDERR.reopen('/dev/null', 'a') 12: 13: yield 14: end 15: end
(Not documented)
# File lib/mcollective/unix_daemon.rb, line 17 17: def self.daemonize_runner(pid=nil) 18: raise "The Unix Daemonizer can not be used on the Windows Platform" if Util.windows? 19: 20: UnixDaemon.daemonize do 21: if pid 22: begin 23: File.open(pid, 'w') {|f| f.write(Process.pid) } 24: rescue Exception => e 25: end 26: end 27: 28: begin 29: runner = Runner.new(nil) 30: runner.run 31: ensure 32: File.unlink(pid) if pid && File.exist?(pid) 33: end 34: end 35: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.