Supervisor always quit process with ‘exit status 0; not expected’

supervisord

I'm currently rebuilding my vps, and I'd like to use supervisor for managing my gunicorn/wsgi django processes. Thing is, supervisor keeps exiting the processes:

2010-07-23 14:54:40,575 INFO supervisord started with pid 31391
2010-07-23 14:54:41,582 INFO spawned: 'projectx' with pid 31395
2010-07-23 14:54:41,691 INFO exited: projectx (exit status 0; not expected)
2010-07-23 14:54:42,695 INFO spawned: 'projectx' with pid 31401
2010-07-23 14:54:42,801 INFO exited: projectx (exit status 0; not expected)
2010-07-23 14:54:44,806 INFO spawned: 'projectx' with pid 31404
2010-07-23 14:54:44,912 INFO exited: projectx (exit status 0; not expected)
2010-07-23 14:54:47,917 INFO spawned: 'projectx' with pid 31408
2010-07-23 14:54:48,022 INFO exited: projectx (exit status 0; not expected)
2010-07-23 14:54:49,023 INFO gave up: projectx entered FATAL state, too many start retries too quickly

This is the config I'm using:

[program:projectx]
command=/path/to/project/bin/gunicorn_django -c /path/to/project/project/gunicorn.conf.py /path/to/project/project/production.py
user=myuser
autostart=true
autorestart=true

I already double checked, and gunicorn_django does return status 0 when it's spawned correctly.

I tried adding exitcodes=0,2 explicitly to the config, but that doesn't seem to make a difference either. It looks like the process is spawned correctly, but supervisor thinks it didn't.

Best Answer

If gunicorn_django is daemonizing itself, it's not the kind of program supervisor is designed to manage. Supervisor expects its supervised programs to run in the foreground so it can monitor if they've exited.

See supervisord docs.