Re: Easy way to daemonize a POE script?
[email protected] (Joel Bernstein) Wed, 10 Mar 2010 18:17:18 +0000
| Newsgroups | perl.poe |
|---|---|
| Message-ID | <[email protected]> |
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