[Twisted-Python] daemonization
Clark C. Evans
cce at clarkevans.com
Sun Feb 23 16:21:28 MST 2003
Hello. I've got my application working nicely (well, the linkage
to postgresql still needs work) and it looks sort of like:
if __name__ == '__main__':
root = Resource()
root.putChild("dynamic",MyDynamicResource())
root.putChild("",Redirect("/static/"))
root.putChild("static",static.File("/path/to/me/webpages"))
site = server.Site(root)
appl = Application("whatever")
appl.listenTCP(8081,site)
appl.run()
What I'd like to do now is have this act like a deamon where
I run a command like:
server start # starts server, and then returns
server stop # stops server
server reload # reloads server
also including functionality of logging to a given file
and rotating the logs as necessary. Anyway, I'm sure there
is shell script magic to do this or I could copy the deamon
example in the ASPN Cookbook...
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/66012
But, I was wondering if there was a simple thing I could inherit
from which would do such a thing automagically.
Clark
P.S. Yes, I suppose this is what that "taps" thing is all
about... however, it doesn't seem to do the deamon
management well (it doesn't do stop/start/reload, right?)
More information about the Twisted-Python
mailing list