[Twisted-Python] how to daemonize twisted...and detatch from shell process

Glyph glyph at twistedmatrix.com
Mon Oct 15 12:01:46 EDT 2012


On Oct 7, 2012, at 5:13 PM, Stephan <schenette at gmail.com> wrote:

> hey Jean-Paul,
> 
> I'm using twistd - if you see the daemon code it's in there to start and manage the service.
> 
> For some reason the OC Daemon pastebin linkted didn't work but this one does:
> 
> OC Daemon that starts the OC Service
> http://pastebin.com/g0UE7An8
> 
> still know don't know what to change to get the service to run and detach from the parent process. Any help is appreciated.
> 
> Stephan

The fact that "ocapi.py" is in "/usr/sbin" suggests that it's designed to be run as a script and not as a twistd plugin.  The shell script that you're citing is mostly irrelevant - that's just a wrapper to get twistd to run on your platform.

And, indeed, when I look at ocapi.py, I can see it has a 'reactor.run()' at the bottom of it, which means it's trying to run itself, not be run by twistd.  That's not how a file passed to '--python' is supposed to work.

Are you the maintainer of ocapi.py? If not, you'll have to get them to make some changes.

-glyph

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-python/attachments/20121015/23662e0a/attachment.htm 


More information about the Twisted-Python mailing list