如何配置celery在Nginx启动时运行?

编程入门 行业动态 更新时间:2024-10-28 00:27:33
本文介绍了如何配置celery在Nginx启动时运行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我只是通过运行celery -A proj -l info在本地运行celery(尽管我什至不知道我是否应该在生产中使用此命令),并且我希望每次nginx启动时都能在生产Web服务器上运行celery.初始化系统为systemd

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 on my production web server every time nginx starts. The init system is systemd

推荐答案

创建这样的服务文件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 $MAINPID ExecStop=/bin/kill -s TERM $MAINPID Restart=on-abort PrivateTmp=true [Install] WantedBy=multi-user.target

将文件移动到/etc/systemd/system/,下次重启服务器时,celery将由systemd在启动时启动.

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

更多推荐

如何配置celery在Nginx启动时运行?

本文发布于:2023-11-05 06:25:09,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1560147.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:启动时   celery   Nginx

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!