[Twisted-Python] Cleanly shutting down Service

Itamar Shtull-Trauring itamar at itamarst.org
Mon Apr 3 11:36:15 EDT 2006

On Sun, 2006-04-02 at 11:21 -0700, apocalypznow wrote:
> How do I cleanly shut down a Service?  I want the shut down to make the 
> stopService() method get called.

Either use twistd with a .tac, as someone else suggested, or:

reactor.addSystemEventTrigger('before', 'shutdown', myservice.stopService)

If stopService returns a Deferred this will delay shutdown until
Deferred returned from stopService is triggered.

More information about the Twisted-Python mailing list