Linux – Is it possible to run automatically celery at startup

celerydjangolinux

I have python server based on django and celery. Each time computer restarts, apache2 starts so my server is working, BUT I have to restart celery manually (going to my project directory and executing "python manage.py celeryd"). What is the correct solution for production? I mean, is there a possibility to start celery as daemon?

Here http://github.com/ask/celery/tree/master/contrib/debian/init.d/ I found two scripts which looks like they should be in /etc/init.d/ like apache2 script that starts apache2. But I put them to /etc/init.d/ and as I see nothing changes.

Best Answer

You could manually symlink the /etc/init.d scripts from /etc/rc5.d/, to start when your GUI does. And you'd need another for shutdown.

But Debian has a more advanced (and better) method. This controls what gets linked from the individual runlevels init scripts. That's what the "BEGIN INIT INFO" is used for in the comments section at the top of those scripts.

If you're actually using Debian, instead of just using scripts from one of their resources, try using

update-rc.d celerybeat defaults
update-rc.d celeryd defaults

Related Topic