[Twisted-Python] Daemonize

Mary Gardiner mary-twisted at puzzling.org
Mon Mar 7 17:05:52 MST 2005


On Mon, Mar 07, 2005, Dan wrote:
> 
> There are lots of nice examples in the Twisted documentation on how to 
> write a server but I can't seem to find anywhere that making it daemonize 
> is mentioned.  All the examples hold onto the terminal after reactor.run() 
> is called.  If I want a Twisted server to return the terminal and run as a 
> daemon how would I accomplish that aside from starting it with nohup?

You'd write a .tac file and run it with "twistd -y [tac file]".

The documentation is at
http://twistedmatrix.com/documents/current/howto/application but is
terse and desperately short on examples.

Several of the examples use that setup:

http://twistedmatrix.com/documents/current/examples/chatserver.py
http://twistedmatrix.com/documents/current/examples/emailserver.py

At the end of the tutorial intro, the finger code is converted to a tac
file too:
http://twistedmatrix.com/documents/current/howto/tutorial/intro

The crucial step is creating the object called 'application' at the
global level -- this is what twistd seeks.

-Mary




More information about the Twisted-Python mailing list