[ale] $SIG{'HUP'}

Christopher Fowler cfowler at outpostsentinel.com
Thu May 26 20:35:06 EDT 2005


I've got this working.  I knew how to do it in C but I thought there
might be a perl way to do it.  There is not.  You have to do it the same
way

use POSIX;

sub SIGHUP {
  # do Something
}
  my $sigset = POSIX::SigSet->new();
  my $action = POSIX::SigAction->new('SIGHUP', $sigset,
&POSIX::SA_NODEFER);
  POSIX::sigaction(&POSIX::SIGHUP, $action);



On Thu, 2005-05-26 at 15:00, Christopher Fowler wrote:
> 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
> 
> 
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> http://www.ale.org/mailman/listinfo/ale



More information about the Ale mailing list