Notifications when process is killed

Thomas Jollans t at jollybox.de
Mon Aug 1 06:52:03 EDT 2011


On 01/08/11 11:56, Andrea Di Mario wrote:
> Hi, i've created a twisted server application and i want that the
> server send me a message when someone stops or kills the process.
> I want to override reactor.stop(), but do this way send me message
> when the process is stopped by a system kill?
> Could you suggest me if there's a way to do this?
> 
> Thanks, regards.
> 
 I don't know anything about Twisted, but you'd usually want to install
a signal handler for SIGTERM, and perhaps SIGINT (unless you handle
KeyboardInterrupt exceptions) and SIGHUP (for when the controlling
terminal is lost, which usually causes a process to quit)

I'm assuming you're using a UNIX-like system

 - Thomas



More information about the Python-list mailing list