pileofrogs has asked for the wisdom of the Perl Monks concerning the following question:
I'm trying to figure out what signals are hitting a script of mine. I'd like to write a default signal handler that sends a note to syslog and then does whatever the signal would have done originally.
I tried this...
map { $SIG{$_} = \&handlesig } keys(%SIG); sub handlesig { my $sig = shift; syslog('info',"Got signal '$sig'"); local $SIG{$sig} = 'DEFAULT'; kill $sig, $$; }
But the local $SIG{$sig} = 'DEFAULT'; line doesn't seem to do anything. handlesig gets called recursively 50-odd times, and then my script dies.
Thanks!
-Pileofrogs
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Signal Question
by ikegami (Patriarch) on Nov 29, 2006 at 22:53 UTC | |
by tye (Sage) on Nov 30, 2006 at 00:41 UTC | |
|
Re: Signal Question
by jbert (Priest) on Nov 30, 2006 at 09:01 UTC | |
|
Re: Signal Question
by superfrink (Curate) on Nov 30, 2006 at 05:08 UTC | |
|
Re: Signal Question
by zentara (Cardinal) on Nov 30, 2006 at 12:06 UTC | |
by andyford (Curate) on Jan 16, 2007 at 21:09 UTC |