twisted signal handler override or cleanup code

Jp Calderone exarkun at divmod.com
Wed Sep 1 10:32:50 EDT 2004


Diez B. Roggisch wrote:
> Hi,
> 
> google doesn't give me anything on this, so I have to ask:
> 
> I've got a xmlrpc-server running using twisted. Using the cookbook-recipe
> for daemonizing, it stores a file with its pid when in daemon mode.
> 
> Now I want to remove that file when the server is shutdown - this boils down
> to the twisted reactors run()-method beeing terminated.
> 
> Unfortunately, twisted sets its on signal handlers, so killing my app
> doesn't allow me to perform cleanup-code. I'm sure there are good reasons
> for that, and I'm actually not interested in signals especially - but there
> must be some way to install a sort of callback when the reactor gets down,
> for whatever reason.
> 
> But as I said, no docs on that. 
> 

     http://twistedmatrix.com/documents/current/man/twistd-man.html

     http://twistedmatrix.com/documents/current/howto/application

   Jp



More information about the Python-list mailing list