Run Python Server at Startup

Posted by DizzyDoo on Server Fault See other posts from Server Fault or by DizzyDoo
Published on 2010-12-26T16:20:23Z Indexed on 2010/12/26 16:55 UTC
Read the original article Hit count: 342

Filed under:
|
|
|
|

Hello, I've got a few Python based servers that I need to run, and would like them to start automatically when I start my Ubuntu Server box. What is the best way to execute them like this?

I was hoping I could write a Bash script and use Screen to get them running in the background, where I can check on them every now and then, but where as

echo screen -d -m python

works just fine,

echo screen -d -m `sudo python /home/matt/tornadoServer/tornadoDeploy.py`

doesn't, with no error messages. Is that something to do with the spaces? Even though I did surround it with backquotes? I also tried:

WEB="screen -d -m `sudo python /home/matt/tornadoServer/tornadoDeploy.py`"
echo $WEB

As a way of escaping the spaces, but no luck. What's Bash scripting way to do this?

And, once the Bash script works, where can I put it to make it execute on startup?

© Server Fault or respective owner

Related posts about ubuntu

Related posts about server