Writing to log file when script is killed

Miki Tebeka miki.tebeka at zoran.com
Sun May 1 10:27:49 EDT 2005


Hello Heiko,

> Am Samstag, 30. April 2005 14:26 schrieb wittempj at hotmail.com:
> > If you run on unix you can use the signal module to intercept a kill -
> > see http://docs.python.org/lib/node368.html for a quick example
> 
> You cannot intercept a kill (that's the whole meaning of SIGKILL, rather than 
> SIGTERM)... Read up on UNIX signal handling.
> 
> But, for the rest: you could intercept SIGTERM, log a message, and raise a 
> SystemExit exception. That should do the trick.
You can also use "register" from "atexit" module.

Bye.
--
------------------------------------------------------------------------
Miki Tebeka <miki.tebeka at zoran.com>
http://tebeka.bizhat.com
The only difference between children and adults is the price of the toys
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 193 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20050501/21def457/attachment.sig>


More information about the Python-list mailing list