Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question
add comment

3 Answers

up vote 3 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
add comment

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
add comment

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 manage.py 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
add comment

Your Answer

 
discard

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