3

I am very new to using Twisted. I have set up a protocol in a .py and it works perfectly. The thing is that currently to test it I have to ssh into my server and run it. I would like to have it running as a service/server so it is always serving my protocol. I read on the twisted site something about .tac files but I'm not sure how to tie that in with the protocol file I've written.

All I have is a simple socket based iPhone app that sends messages to the reactor and receives messages back.

I would like this to start up when the server boots. Much like an apache server works.

Thanks for your help.

utahwithak
  • 6,235
  • 2
  • 40
  • 62
  • Your question vaguely implies that you're trying to have your server application always running. However, it's unclear why you can't just run your server application when your server host boots up to achieve this. Please clarify. – Jean-Paul Calderone Dec 20 '11 at 12:42
  • check if this answers your question http://stackoverflow.com/questions/1603109/how-to-make-a-python-script-run-like-a-service-or-daemon-in-linux – llazzaro Dec 20 '11 at 18:28
  • @llazzaro That is similar but not quite the same I need the script to be constantly running in the background like a web server not a timed wait between running. Deamonizing it is what I want and I know there is a way that twisted does this internaly. I am hoping someone knows how to do just that. – utahwithak Dec 20 '11 at 18:52
  • @cwieland check that someones answered how to daemonize a python script. http://www.jejik.com/articles/2007/02/a_simple_unix_linux_daemon_in_python/ he copy his answer from there. if you find a twisted way that will be great! – llazzaro Dec 20 '11 at 19:00

1 Answers1

2

Daemonization in twisted is achieved via the twistd shell command. I found this tutorial quite useful: Using the Twisted Application Framework

thatwasbrilliant
  • 511
  • 4
  • 11