in reply to My daemon will not restart

Do you close the open socket in your sub release_the_pid_file()? (Not shown in the source you provide)(Update:Just noticed that this is a sub of Proc::PID_File)

You're not closing the open socket. The system may not yet have disassociated the open socket with your old process, and the new one will be unable to bind to it (you can't have two processes listening to the same TCP port). The subsequent die "Failed to restart daemon" will never be reached because it's after the exec.


All dogma is stupid.

Replies are listed 'Best First'.
Re^2: My daemon will not restart
by pc88mxer (Vicar) on Feb 14, 2008 at 17:54 UTC
    This is a good suggestion. If you add:

    $server = undef;
    right before (or in) the call to &restart_daemon, things might work for you (at least they did in a stripped down version of your code.)
      I have undefing $server, as well as explicitly undefing $server->{_sock}, but with no change in behaviour.

      -=( Graq )=-