Upstart is a ridiculously easy way to turn your scripts into daemons. Take this python script:


import time
while 1:
    print("I'm a daemon!")

We’re going to turn it into a daemon with a single line:


exec python /home/myuser/

And that’s it!

  • sudo start ez_daemon
  • sudo tail -f /var/log/upstart/ez_daemon.log
  • sudo stop ez_daemon

You can do this for any program, and it’s how Ubuntu and Fedora start most daemons.

Here’s a more complete example:

author "Graham King <>"
description "uwsgi server for"

start on (static-network-up and started mysql)
stop on shutdown

console log
respawn limit 10 5

setuid www-data
setgid www-data

env PYTHONPATH=/srv/example/src/example/

exec /srv/example/bin/uwsgi \
--virtualenv=/srv/example/ \
--module=example.django_wsgi  \

Each line is called a stanza, and they are documented in the Upstart cookbook.

It’s clear, it’s easy, and it works. And that makes me happy.