Celery daemonization:celery.service:步骤失败USER产卵/ home / mike / movingcollage / movingcollageenv / bin / celery:没有这样的过程

时间:2018-03-21 18:30:19

标签: celery daemon systemd

journalctl -f之后我systemctl start celery.service获得

Mar 21 19:14:21 ubuntu-2gb-nyc3-01 systemd[1]: Reloading.
Mar 21 19:14:21 ubuntu-2gb-nyc3-01 systemd[1]: Started ACPI event daemon. 
Mar 21 19:14:25 ubuntu-2gb-nyc3-01 systemd[21431]: celery.service: Failed at step USER spawning /home/mike/movingcollage/movingcollageenv/bin/celery: No such process
Mar 21 19:14:25 ubuntu-2gb-nyc3-01 systemd[1]: Starting celery service...
Mar 21 19:14:25 ubuntu-2gb-nyc3-01 systemd[1]: celery.service: Control process exited, code=exited status=217
Mar 21 19:14:25 ubuntu-2gb-nyc3-01 systemd[1]: Failed to start celery service.
Mar 21 19:14:25 ubuntu-2gb-nyc3-01 systemd[1]: celery.service: Unit entered failed state.
Mar 21 19:14:25 ubuntu-2gb-nyc3-01 systemd[1]: celery.service: Failed with result 'exit-code'.

这是我的celery.service配置:

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

[Service]
#PIDFile=/run/celery/pid
Type=forking
User=celery
Group=celery
#RuntimeDirectory=celery  
WorkingDirectory=/home/mike/movingcollage
ExecStart=/home/mike/movingcollage/movingcollageenv/bin/celery multi start 3 -A movingcollage "-c 5 -Q celery -l INFO"
ExecReload=/home/mike/movingcollage/movingcollageenv/bin/celery multi restart 3
ExecStop=/home/mike/movingcollage/movingcollageenv/bin/celery multi stopwait 3

[Install]
WantedBy=multi-user.target

有谁知道出了什么问题?提前致谢

2 个答案:

答案 0 :(得分:0)

对于2000_01_01 01:00:00我认为最好使用celery multi。 Celery可以启动许多工作流程,每个流程都有自己的PID。

我这样开始Type=oneshot

celery

当然,在您的情况下celery multi start 2\ -A my_app_name\ --uid=1001 --gid=1001\ -f /var/log/celery/celery.log\ --loglevel="INFO"\ --pidfile:1=/run/celery1.pid\ --pidfile:2=/run/celery2.pid uid和所有路径都会有所不同。

答案 1 :(得分:0)

您需要更改:

User=celery
Group=celery

以您的用户和组为例,

User=ubuntu
Group=ubuntu