Skip to content Skip to sidebar Skip to footer

How Can I Configure Celery To Run On Startup Of Nginx?

I have celery running locally by just running celery -A proj -l info (although I don't even know if I should be using this command in production), and I want to get celery running

Solution 1:

Create a service file like this celery.service

[Unit]Description=celery service
After=network.target

[Service]PIDFile=/run/celery/pid
User=celery
Group=celery
RuntimeDirectory=/path/to/project
WorkingDirectory=/path/to/project
ExecStart=celery -A proj -l info
ExecReload=/bin/kill -s HUP $MAINPIDExecStop=/bin/kill -s TERM $MAINPIDRestart=on-abort
PrivateTmp=true[Install]WantedBy=multi-user.target

Move the file to /etc/systemd/system/ and next time your restart server, celery will be started by systemd on boot.

Post a Comment for "How Can I Configure Celery To Run On Startup Of Nginx?"