tags:

views:

232

answers:

1

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.

+3  A: 

You should take a look at http://www.debian-administration.org/article/Making_scripts_run_at_boot_time_with_Debian

In short, with the celeryd script in /etc/init.d:

$ update-rc.d celeryd defaults
Adding system startup for /etc/init.d/celeryd ...
    /etc/rc0.d/K20celeryd -> ../init.d/celeryd
    /etc/rc1.d/K20celeryd -> ../init.d/celeryd
    /etc/rc6.d/K20celeryd -> ../init.d/celeryd
    /etc/rc2.d/S20celeryd -> ../init.d/celeryd
    /etc/rc3.d/S20celeryd -> ../init.d/celeryd
    /etc/rc4.d/S20celeryd -> ../init.d/celeryd
    /etc/rc5.d/S20celeryd -> ../init.d/celeryd
asksol
Thanks, I will try that, what about celerybeat? Do I need to update-rc.d it too?
Graf
Yes! remember to only run one instance of it though!
asksol
Wow! Works like a charm to me! Unfortunately, I spent a lot of time to find out what did I do wrong (forgot to chmod 755 both scripts), but finally everything is working! Thanks for your help, asksol!
Graf