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."
In reply to Re^3: print on reboot or process shutdown
by psini
in thread print on reboot or process shutdown
by marto9
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |