Hi How do I make my xmlrpc server a daemon? The code that starts the server is: r = rmsWebServices() xmlrpc.addIntrospection(r) reactor.listenTCP(7080, server.Site(r)) reactor.run() What should I change? Thanks Gustavo
At 2006-02-08 11:14 AM -0200, you wrote:
Hi
How do I make my xmlrpc server a daemon?
The code that starts the server is:
r = rmsWebServices() xmlrpc.addIntrospection(r) reactor.listenTCP(7080, server.Site(r)) reactor.run()
What should I change?
Since you said "daemon" and not "service", you're presumably running on an *nix box. A daemon is, fundamentally, just a program that doesn't exit when you do. Your friends are nohup and '&'. So if you start the server for testing using myserver.py<enter> then the simplest way to start it as a daemon is this way: nohup myserver.py &<enter> '&' detaches it from the current process I/O so you can continue using the console for other things. 'nohup' detaches it from the current user so it keeps running after you log out. If you start it this way from a system startup script, you have an always-on daemon. - Sam
Thanks Gustavo
_______________________________________________ Twisted-web mailing list Twisted-web@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web
__________________________________________________________ Spinward Stars, LLC Samuel Reynolds Software Consulting and Development 303-805-1446 http://SpinwardStars.com/ sam@SpinwardStars.com
Samuel Reynolds wrote:
At 2006-02-08 11:14 AM -0200, you wrote:
Hi
How do I make my xmlrpc server a daemon?
The code that starts the server is:
r = rmsWebServices() xmlrpc.addIntrospection(r) reactor.listenTCP(7080, server.Site(r)) reactor.run()
What should I change?
Since you said "daemon" and not "service", you're presumably running on an *nix box.
A daemon is, fundamentally, just a program that doesn't exit when you do. Your friends are nohup and '&'.
So if you start the server for testing using myserver.py<enter> then the simplest way to start it as a daemon is this way: nohup myserver.py &<enter>
'&' detaches it from the current process I/O so you can continue using the console for other things. 'nohup' detaches it from the current user so it keeps running after you log out.
If you start it this way from a system startup script, you have an always-on daemon.
- Sam
Actually what I meant was service :) I wan't to use with twistd I saw the example in the twisted book but I didn't understand how to adapt to my situation. Gustavo
On Wed, 08 Feb 2006 11:14:12 -0200, Gustavo Rahal <gustavo@grahal.net> wrote:
Hi
How do I make my xmlrpc server a daemon?
The code that starts the server is:
r = rmsWebServices() xmlrpc.addIntrospection(r) reactor.listenTCP(7080, server.Site(r)) reactor.run()
What should I change?
Twisted comes with a daemonizer, `twistd'. Rewrite the above as: from twisted.application import service, internet application = service.Application("RMS Web Service") ... website = internet.TCPServer(7080, server.Site(r)) website.setServiceParent(application) And then run it using "twistd -y <filename>". Jean-Paul
participants (3)
-
Gustavo Rahal
-
Jean-Paul Calderone
-
Samuel Reynolds