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"'
In reply to Re: How do I run an Infinite loop with a CGI?
by rob_au
in thread How do I run an Infinite loop with a CGI?
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |