Re: Easy way to daemonize a POE script?
Bruce Ferrell <[email protected]> Wed, 10 Mar 2010 10:24:02 -0800
| Newsgroups | gmane.comp.lang.perl.poe |
|---|---|
| Message-ID | <[email protected]> |
On 03/10/2010 10:17 AM, Joel Bernstein wrote: > On 10 March 2010 18:02, Bruce Ferrell <[email protected]> wrote: > >> On 03/10/2010 08:24 AM, [email protected] wrote: >> >>> Winfried Neessen wrote: >>> >>>> Now I'd like to run it independently, so my question is, is there an >>>> easy way for me to run a POE >>>> >>>> script daemonized (w/o having to use Unix backgrounding/forking)? >>>> > >> Below is the code I use. Ã It's a slightly modified version I found when >> I googled for Perl daemon >> > No no. This is not the approach. You're WRITING THIS CODE YOURSELF > RATHER THAN USING A CPAN MODULE. I hope you have lots of tests for > this wheel... > > BTW, I'd need a copy of Stevens handy to be sure, but I recall that > the canonical unix daemonisation dance goes: > double fork > close standard file descriptors > become session leader (POSIX::setsid IIRC) > become process group leader (POSIX::setpgrp IIRC) > set signal mask to ignore SIGHUP > change working dir to root > set file creation mask (umask) > drop privileges > > I might well be missing a step. I think you did, too, though. > > /joel > > > Been working several years now and like I say I got it straight off a perl.org tutorial