Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

Re^3: print on reboot or process shutdown

by psini (Deacon)
on Jul 29, 2008 at 21:30 UTC ( #700927=note: print w/replies, xml ) Need Help??

in reply to Re^2: print on reboot or process shutdown
in thread print on reboot or process shutdown

You can use a signal handler to cacth SIGTERM

$SIG{TERM}=sub { #do something here };

But that cannot trap a SIGKILL so if you or your system make a kill -9, it will not be intercepted. And, no, AFAIK there is no way to intercept a SIGKILL because it should be the last resort to kill a not responding process.

Rule One: "Do not act incautiously when confronting a little bald wrinkly smiling man."

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://700927]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (4)
As of 2016-10-25 05:32 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (315 votes). Check out past polls.