Ubuntu has now days awesome start/stop system called Upstart which has replaced /sbin/init. It is also capable to supervising processes. It is really simple to add new processes to upstart. I wanted my blog start automatically on system boot and therefore I added my blog under upstarts control.
I use Gunicorn behind nginx to serve my blog and there is one gotcha with Upstart and Gunicorn. When you call gunicorn with --daemon, the started process forks a new child and exits immediately. Since the initially created process exited, Upstart thinks that the spawning the process failed and tries to restart it. The result of this was that I had over 50 gunicorn processes serving my blog. For this reason Upstart has expect fork flag. After I added that flag everything worked as expected. Here is my working upstart config which I placed on /etc/init/blog.conf and after that Upstart took care of the rest.
start on runlevel [23] stop on runlevel [06] stop on shutdown respawn expect fork script /path/to/.virtualenvs/blog/bin/python /path/to/.virtualenvs/blog/bin/gunicorn_django --workers=2 -D -b unix:/path/to/gunicorn.sock /path/to/settings.py end script

Comments