in reply to How do I run an Infinite loop with a CGI?
True to the spirit of there being more than one way to do it, there a number of ways by which a Perl script can detach from its controlling process and act as a daemon process. One of the easiest methods is through the use of the Proc::Daemon module from CPAN - For example:
use Proc::Daemon; Proc::Daemon::Init; . . . # The rest of the script follows
This code will fork a child and exit the parent process, detaches from the controlling terminal, forks a second process and detaches the parent process (preventing the potential of acquiring a controlling terminal), changes to the root directory, clears the file creation mask and closes all open file descriptors - This procedure is the same as that described by W. Richard Stevens in Advanced Programming in the UNIX Environment.
perl -e 'print+unpack("N",pack("B32","00000000000000000000000111011011")),"\n"'
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How do I run an Infinite loop with a CGI?
by tadman (Prior) on Nov 08, 2002 at 16:55 UTC | |
|
Re: Re: How do I run an Infinite loop with a CGI?
by JamieD (Novice) on Nov 08, 2002 at 22:38 UTC | |
by rob_au (Abbot) on Nov 09, 2002 at 00:29 UTC |