Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

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

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/ 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 instead of gunicorn directly? I'll give running it directly a shot as soon as I get a chance.

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

share|improve this question

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.

share|improve this answer
man 5 init was very helpful, thanks! – adonm Nov 8 '10 at 4:35

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.


share|improve this answer

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.