Titu Kim wrote:
> Hi,
>    I am writing a simple perl script that will catch
> kill signal. I am able to catch the signal sent within
> the script. However, if I kill the process in a shell
> using "kill -9 PID", the handler does not catch it.
> Can someone help me? Here is my code snippet.
> 
> ==========Handler =================================
> $SIG{TERM}=\&signal_handler_TERM;
> sub signal_handler_TERM{
>      $SIG{TERM} =\&signal_handler_TERM;
> 
>      print "---------Catching Term signal, Cleaning up--------\n";
>      exit(1);
> }
> ===================================================
> 
> In perl script, if i use kill function as this
> 
> "kill TERM => PID;"
> 
> It works fine. However, if I issue kill signal from
> shell like this "kill -9 PID", PID is killed but
> signal is not caught by signal_handler_TERM.

SIGTERM is 15, not 9. 9 is SIGKILL, which cannot be caught.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to