Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a very simple Python script that I'd like to be always running on my ubuntu 12.04 server. I thought of using upstart + monit. Problem is that those tools seem rather complicated for a simple mortal like me, and I cannot find a simple example on the web.

Is upstart + monit overkill ? / Does somebody know a simpler alternative ? / or a good tutorial ?

share|improve this question
As I just want the script to be running, isn't upstart enough ? Monit is needed only to make a test periodically right !? – sebpiq Aug 14 '12 at 14:28
up vote 7 down vote accepted

Taken from this answer:

You could write a bash script which starts your python script and restarts it if it crashes but doesn't restart if the script exits normally:

until; do
    echo "'' crashed with exit code $?. Restarting..." >&2
    sleep 1

Then just start the monitor script in background:

nohup &

As an alternative to nohup, you may also consider tmux or screen for running background processes.

share|improve this answer
Works like a charm, and so easy ! Thanks :) – sebpiq Aug 14 '12 at 14:59

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.