Using Celery in one of my projects I always found it a bit uncomfortable to start the worker processes by hand. Today someone else came up with the same problem on ServerFault. It motivated me to investigate a bit further on other options to accomplish this task.

Looking inside the contrib folder of the celery distribution led me to a project called Supervisor. It's purpose is to control project related tasks in addition to the usual Sys-V-Init process running at boot. Actually it starts one management process through Sys-V and then starts tasks or daemons configured for various projects like celery worker processes.

Debian/Unstable already has a package for Supervisor which offers the directory /etc/supervisor/conf.d/ as a drop-in-location for project-related configurations.

aptitude install supervisor

I took the sample configuration from my python-celery Debian package and placed it at /etc/supervisor/conf.d/project.conf, modifying it to fit my needs:

; =======================================
;  celeryd supervisor for Django project
; =======================================

[program:celery.project]
command=django-admin celeryd --settings=setting --pythonpath=/path/to/project/
directory=/path/to/project/
user=nobody
numprocs=1
stdout_logfile=/var/log/celery/project.log
stderr_logfile=/var/log/celery/project.log
autostart=true
autorestart=true
startsecs=10

; if rabbitmq is supervised, set its priority higher
; so it starts first
priority=998