[Twisted-Python] How to stop a twisted daemon application.

Tim Allen screwtape at froup.com
Fri Nov 14 01:06:31 EST 2008


On Fri, Nov 14, 2008 at 01:49:04PM +0800, Peter Cai wrote:
> After I have run "twistd -y xxx.py"
> 
> How can I stop it?  I've read through twistd manual and didn't find
> anything about this.
> 
> I have to find the process and kill it.

When you run twistd, it should create a 'twistd.pid' file in the current
directory containing the process-ID of the twistd process.

I believe the standard method of stopping a background twistd is:

    kill $(cat twistd.pid)

Also note the -n/--nodaemon command-line option which stops twistd from
vanishing into the background at all. If start twistd like this:

    twistd -n -y xxx.py

...then you will get the log output written to the screen (rather than
to a logfile) and you can kill the server with Ctrl-C instead of having
to mess around with pid files.





More information about the Twisted-Python mailing list