[ale] $SIG{'HUP'}

Christopher Fowler cfowler at outpostsentinel.com
Thu May 26 15:09:55 EDT 2005


The child that gets executed after a SIGHUP ignores SIGHUP.  What is the
best way to fix in Perl?

  $SIG{'HUP'} = sub {
    _print "Recevied SIGHUP! Restarting.\n";

    # Kill all the children
    my @goners = ();
    foreach my $ref (keys %GordonKapes) {
      push @goners, $GordonKapes{$ref}{'PID'};
    }

    $TERMINATION = 1;
    kill 9, @goners;

    my $pid = fork();
    exit 0 if $pid;

    # Allow things to settle down;
    sleep(1);

    exec ("/opt/SAM/gk/gkd.pl") or die "$!\n";

  };

Thanks, 
Chris




More information about the Ale mailing list