in reply to Re: killing perl scripts
in thread killing perl scripts

On my system at least, you can't catch KILL. This code prints KILL signal caught when KILL is caught:
[gifford@gifford gifford]$ perl -e'$SIG{KILL}=sub { die "KILL signal c +aught"; }; sleep(10)' & [1] 4316 [gifford@gifford gifford]$ kill -9 4316 [gifford@gifford gifford]$ [1]+ Killed perl -e'$SIG{KILL}=sub { die "KILL signa +l caught"; }; sleep(10)'

Replies are listed 'Best First'.
Re^3: killing perl scripts
by radiantmatrix (Parson) on Dec 13, 2004 at 18:54 UTC

    Yes, that is how it should work. However, I have seen the occasional two-stage KILL signal, where kill -9 sends SIGKILL only truly destroys the process if the SIG is not handled by the application after few ticks.

    I don't know how common that is, but it's still unwise to set $SIG{KILL} unless you know for sure it will be safe to do so.

    radiantmatrix
    require General::Disclaimer;
    s//2fde04abe76c036c9074586c1/; while(m/(.)/g){print substr(' ,JPacehklnorstu',hex($1),1)}