generally, you should take the following steps to daemonize a program:
* Fork your program. The parent exits and the child continues with the following steps.
* Close or reassign STDOUT, STDIN and STDERR (to avoid scribbling all over the terminal the process was started from). You can outright close the file descriptors or redirect them to /dev/null or something.
* Dissociate from your terminal to avoid dying when the original shell you started from exits.
A specific example that implements the above three things is linked from Dog and Pony's post above.
Once you have a properly daemonizing script, you can put it in the /etc/rc.d hierarchy to have it started automatically at system boot time (if you have a System V startup sequence, that is :) ).
CU
Robartes-
In reply to Re: how to make a demon in perl?
by robartes
in thread how to make a demon in perl?
by Sihal
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |