On Sunday, Feb 19th 2006 at 23:31 -0800, quoth Ranga Nathan: =>I have a perl script that is in the start-up. Currently the startup uses =>"nohup <myscript> &". But that causes the script to swap out when there is =>no activity for a while. I am thinking of using "damon" command to =>daemonize it. The script simply tails xfer log and takes action on files =>being deposited. It is not a server. => =>I would like to know the common and accepted practice. => =>Thanks
You might need a clarification of what steps a proper daemon needs to do to be a proper daemon. 1. You need to close all of your open file descriptors. This is needed because if the daemon is started from a terminal, then that process will not relinquish control from that terminal. 2. You need to do the double fork trick to end up as a child of init. 3. You probably want to call setsid(2) and setpgrp(2) to ensure that you are the head of your own process group and session. 4. Set your signal handlers for SIGTTIN and SIGTTOU to ignore. 5+. There may be more but I can't remember them. :-) -- Time flies like the wind. Fruit flies like a banana. Stranger things have .0. happened but none stranger than this. Does your driver's license say Organ ..0 Donor?Black holes are where God divided by zero. Listen to me! We are all- 000 individuals! What if this weren't a hypothetical question? steveo at syslang.net _______________________________________________ Boston-pm mailing list [email protected] http://mail.pm.org/mailman/listinfo/boston-pm

