in reply to How do I start a perl daemon at boot time

First something general. You should probably take advantage of daemonizing code as it is not trivial. The two editions of the Perl cookbook have recommendations on this. Lincoln Stein's Perl network programming has code on this too. Search daemon on CPAN

Second, in the init script you should use absolute paths for perl and the script it tries to run. For the stop part (that is important too!) you need something like a pidfile that keeps the pid of the started process, so that in the stop part you test the pid reading the file and kill the daemon if up.

hth --stephan
  • Comment on Re: How do I start a perl daemon at boot time

Replies are listed 'Best First'.
Re^2: How do I start a perl daemon at boot time
by shigetsu (Hermit) on Feb 01, 2007 at 21:40 UTC

    Regarding the stopping of a daemon, I've found it useful to use a /global/ variable set to true, loop while variable is true and let the daemon do its work.

    Then, install one or more appropriate signal handlers (lets say, for SIGHUP & friends) and have them undefine the global variable. This allows the daemon to properly to *finish* its operations; critical are, for example, IO operations.

    Without these precautions, some data could get corrupted.

      I finally did it. Thank you all for your support. I still did not understand half a thing I have done but I manage to make the computer do what I wanted from him to do. magnolia