in reply to Perl script as daemon

As moritz points out, there are a number of ways that could prevent a script, that previously ran from CLI, from successfully running as a daemon.

However, IMO, there are 2 questions to which the answers are not as clear as they could be WRT the running of the script as a daemon:

If the answer to the first question is that it only appears to fail when run indirectly i.e. via cron(1M)/init(1M), that would tend to point to a difference/omission in run-time environment/permissions.

OTOH, if the answer to the 2nd question is that it starts, but later, halts, that is indicative of the requirement (on behalf of the script) for standard device access preventing continued script execution - this can be, to some extent, tested by running the script from the CLI, but running the command in background under nohup(1) e.g. nohup command & ...

A user level that continues to overstate my experience :-))

Replies are listed 'Best First'.
Re^2: Perl script as daemon
by Anonymous Monk on Apr 26, 2009 at 22:10 UTC
    Hi, Thanks Bloodnok, see the script itself runs away fine as a daemon, its just the lines that perform the backtick operations will not run at all, but they run fine and return output when the main script is just executed. Sorry if Im not making sense Ive only been at perl a few weeks....
      Try checking the standard variables $!/$? after the backticked (perlop) operation(s) to see what the error (if any) returned by the kernel is.

      A user level that continues to overstate my experience :-))
        Thanks, ok so $! says 'No child processes' and $? is '-1'... Do i need another process to perform these actions? Ive tried a few ways of doing this but haven't had any luck...
        The special variables have -1 and 'No child processes'...