How to run celery as a daemon in production?

后端 未结 5 1059
再見小時候
再見小時候 2020-12-13 02:58

i created a celeryd file in /etc/defaults/ from the code here:

https://github.com/celery/celery/blob/3.0/extra/generic-init.d/celeryd

Now when I want to run

5条回答
  •  执笔经年
    2020-12-13 03:22

    Note: in ubuntu 16.04 my anser with the .conf file is not working anymore.

    I created a .service file and put this in /etc/systemd/system/

    i can use

    sudo service myservice status

    sudo service myservice start

    sudo service myservice stop

    as commands

    e.g. this file:

    myservice.service:

    [Unit] 
    Description=My celery worker 
    
    [Service]
    WorkingDirectory=/srv/my-project-path
    User=buildout
    Group=buildout
    Restart=on-failure
    RestartSec=20 5
    ExecStart=/srv/my-project/bin/django celeryd -BE
    
    [Install]
    WantedBy=multi-user.target
    Alias=myservice.service
    

    note i use buildout, so in setad of bin/django most users need to use the path to python and use mange.py in stead.

    base upon: http://minecraft.gamepedia.com/Tutorials/Ubuntu_startup_script (see the with systemd section)

提交回复
热议问题