in reply to Re: Perl Daemons and SIGHUP
in thread Perl Daemons and SIGHUP

well i tried what you've fixed. but still, after the doing the exec call, the process dies.

It happens also when i use the Daemon::Generic package.

10x

Replies are listed 'Best First'.
Re^3: Perl Daemons and SIGHUP
by cdarke (Prior) on Feb 24, 2010 at 17:24 UTC
    Might I suggest that you try this without any Daemon modules? Just get it running as an ordinary background job using myscript.pl &, because that did not work previously. Even if it still does not work then at least you would have eliminated a chunk of software and we might be able to tie down a simplified version.
    If it does work without the Daemon modules then we know where to look next.
      Hi everyone -

      I am glad to announce that the problem is solved! Well, the reason the process died is bebcaus the exec call failed. And why is that? because the process tried to invoke the script by using the wrong path.

      I will explain:
      As you all surely know, once the process has been daemonized it runs under / directory (root directory). The process then tried to invoke the script by using relative path and not absolute path as it should have done.
      This caused the exec call to fail and thus the process couldn't be restarted. By the way, once the process receives HUP signal it will eventually die anyway. To prevent this you can start it in the signal handler and thus a new process will be created along with this that died.

      Thank you all for your help