Upstart doesn't like to start gunicorn because it tries to call setpgrp (see github issue), what would be the best way to start [gunicorn] on a 10.04.1 server install? - Ideally with automatic restarting of the failed main process and multiple workers. On the gunicorn site they mention [runit] and [supervisord], is it worthwhile installing another kind of process supervisor alongside ubuntu's upstart?

I'll document progress here after exams if someone doesn't come up with a better solution.

OK I've tried:

respawn limit 10 5

expect daemon # also tried expect fork

exec python /path/to/manage.py run_gunicorn --daemon

but I can't seem to get the job to start, it just hangs? nothing shows up in ps aux | grep manage or the syslog, I'm guessing upstart isn't catching the fork properly. Is it because I'm using manage.py instead of gunicorn directly? I'll give running it directly a shot as soon as I get a chance.

Clarification: manage.py is from a django 1.2 instance with gunicorn as an installed app, but no special settings in settings.py (I don't know the syntax for specifying gunicorns port/address/workers in settings.py so I was planning to just use cmdline args)


I've just commented in the github issue as well.

Since there seems to be some issue with setpgrp and gunicorn, you may have better results if you run it with

expect fork

Added to the upstart job definition.

so something like

start on runlevel [2345]
stop on runlevel [!2345]

expect fork

exec /path/to/gunicorn --daemon

Should work well.

'man 5 init' is a wealth of information and should help understand why things work this way.


We just pushed a patch to Gunicorn master [1] that will allow you to use Gunicorn with Upstart. You shouldn't need to use any of the "expect fork" configuration directives with this version.

[1] https://github.com/benoitc/gunicorn

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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