X-Git-Url: https://review.fuel-infra.org/gitweb?a=blobdiff_plain;ds=sidebyside;f=doc%2Fclasses%2FMCollective%2FUnixDaemon.html;fp=doc%2Fclasses%2FMCollective%2FUnixDaemon.html;h=64f02a559155011035bf65687cb3e793b06f17a0;hb=d1f1649ba43c5cbc43c4beb2380096ba051d646a;hp=0000000000000000000000000000000000000000;hpb=8a3fe7daeecccf43dd71c59371c5005400d35101;p=packages%2Fprecise%2Fmcollective.git diff --git a/doc/classes/MCollective/UnixDaemon.html b/doc/classes/MCollective/UnixDaemon.html new file mode 100644 index 0000000..64f02a5 --- /dev/null +++ b/doc/classes/MCollective/UnixDaemon.html @@ -0,0 +1,198 @@ + + + + + + Class: MCollective::UnixDaemon + + + + + + + + + + +
+ + + + + + + + + + + + + + +
ClassMCollective::UnixDaemon
In: + + lib/mcollective/unix_daemon.rb + +
+
Parent: + Object +
+
+ + +
+ + + +
+ + + +
+ +
+

Methods

+ +
+ daemonize   + daemonize_runner   +
+
+ +
+ + + + +
+ + + + + + + + + +
+

Public Class methods

+ +
+ + + + +
+

+Daemonize the current process +

+

[Source]

+
+
+    # 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
+
+
+
+
+ +
+ + + + +
+

[Source]

+
+
+    # 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
+
+
+
+
+ + +
+ + +
+ + +
+

[Validate]

+
+ + + \ No newline at end of file