[Twisted-Python] Help: how to run something at shutdown time
I'm running an xmlrpc server using twisted xmlrpc. I use reactor.callWhenRunning() to do some setup when the server is started, but I need to also do some special shutdown steps when the server is stopped. I don't see any callWhenStopped() or something to that effect...so is there a way to call specific methods when shutdown happens? Any help is appreciated, -David -- Presenting: mediocre nebula.
Quoting David Hirschfield
I don't see any callWhenStopped() or something to that effect...so is there a way to call specific methods when shutdown happens?
Yes : reactor.addSystemEventTrigger('before', 'shutdown', func, args) (actually callWhenRunning calls this method if reactor is not running). -- Thomas
As you might have guessed, I'm something of a twisted newbie here. That seems perfect. Thanks much! -Dave Thomas HERVE wrote:
Quoting David Hirschfield
: I don't see any callWhenStopped() or something to that effect...so is there a way to call specific methods when shutdown happens?
Yes : reactor.addSystemEventTrigger('before', 'shutdown', func, args) (actually callWhenRunning calls this method if reactor is not running).
-- Presenting: mediocre nebula.
participants (2)
-
David Hirschfield
-
Thomas HERVE