On 6 Oct, 10:30 pm, schene...@gmail.com wrote: >Hi, > >I'm attempting to create an ubuntu service that when started will run >in >the background processing beanstalk jobs. >I've taken the code from beanstalk-client twisted to act as my >beanstalk >client ( >https://github.com/dustin/beanstalk-client- >twisted/blob/master/beanstalk.py) > >The issue I'm having is how do I set up my service (ocapi.py) so that >when >the daemon (ocapi) starts it detaches from the process, which isn't' >happening right now.
Use twistd, which comes with daemonization features. From the looks of your code, you're halfway there already. http://twistedmatrix.com/documents/current/core/howto/basics.html#auto1 http://twistedmatrix.com/documents/current/core/howto/application.html Jean-Paul >ocapi.py (service) <--this is what should detach and I put it in >/usr/sbin/ocapi.py code found at http://pastebin.com/29VnXnrm >ocapi (daemon) <-- goes int /etc/init.d/ocapi code found at >http://pastebin.com/0QgRfTfu > >stephan@oc:~$ sudo /etc/init.d/ocapi start >* Starting ocapi... Removing stale pidfile /var/run/ocapi.pid >Connected! > >...problem is I don't get my shell prompt back when i start the >service, >meaning it didn't detach from the parent process...hopefully someone >can >shed some light on this. >Thanks, >Stephan _______________________________________________ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python