Linux – Celery and Django : How to start at boot in production env (linux)

djangolinuxscripting

I have an app that uses celery and django to run distributed tasks (like send email, crawl web,etc).

The app never was in prod, so I always start celeryd with ./manage celeryd.

I want to setup a pre-post env in linux, and I will need information in how to make an init.d script for start the celeryd for django. (I had made some init.d scripts before, no need complete script just relevant part)

Thanks!

Best Answer

Use supervisord, it is superior to self-made sys-v-init scripts when it comes to manage several different processes. Celery ships with example configuration files that you can use to integrate it nicely into supervisord.

If you happen to use Debian as your choice of distribution you can even use the prepackaged supervisor:

aptitude install supervisor

For an example on how to use the "django-admin" command from the Debian python-django package with supervisor take a look at this blog post of mine.