[Twisted-Python] some confusion with daemonising my twisted application.

Andrew Bennetts andrew at bemusement.org
Tue Apr 26 19:39:45 EDT 2011


hackingKK wrote:
> Hello all.
> I have been using the twisted library for quite some time and I must say 
> it is the best library for xmlrpc.
> I have a tcp server listening on a port and I use reactor.run() to start it.
> Now I want to learn how to daemonise the entire code.
[…]
> So I just want to know if I have to write a seperate file to run this as 
> a daemon?
> As a side note, I used twistd -y rpc_main.py to see what happens.

Using twistd -y is a good way to daemonise your Twisted program, but the -y
option takes a “TAC” file, not just any Python file.  They are briefly
described, including an example, here:
<http://twistedmatrix.com/documents/current/core/howto/application.html#auto5>

The really short version is rather than calling reactor methods like
reactor.connectTCP directly, you create a bunch of service objects that will do
those things when started, and attach those to an Application instance called
“application”.  That's a TAC file.

-Andrew.




More information about the Twisted-Python mailing list