Server Fault is a question and answer site for system and network administrators. 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

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 celeryd"). What is the correct solution for production? I mean, is there a possibility to start celery as daemon?

Here 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.

share|improve this question
up vote 4 down vote accepted

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

share|improve this answer
Yes, that's it. Nice solution, works excellent to me! Just don't forget to make scripts executable! – user35348 Mar 2 '10 at 18:25
Should the update-rc.d ... enable command also be run as described here? – raacer Dec 26 '14 at 22:17
I'll readily admit I'm not a huge Debian guy, but I don't think so. I believe the defaults command should also enable the script at the runlevels listed in the script header. The enable argument only seems useful to undo the effects of the disable argument. (See: The 'disabling init scripts' of the man page: – Christopher Karel Dec 31 '14 at 16:10

Celery ships a sample configuration for supervisor, a daemon which takes care of project related tasks and daemons. Debian Unstable already has a packaged version of supervisor available. If you install it you would only need to modify the sample configuration from celery (found in contrib/supervisor) and drop it into /etc/supervisor/conf.d/.

share|improve this answer

You didn't mention which distro you're using. That's important to know because startup scripts vary quite a bit from distro to distro. Assuming you're working with Redhat/CentOS...

Ideally you should track down an init.d script. This is the better option because it's also used to safely shutdown your daemon, reload it's config, restart it, etc. If you want the quick and easy solution though, just stick "python celeryd" at the end of you /etc/rc.local file.

Edit: I see by the path name in your example that you're using Debian. I'm not sure if Debian has an /etc/rc.local file. But I'll leave this answer up just in case it does, or in case this information is useful to someone else.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.