简体   繁体   English

使用主管启动Huey(Redis Celery)消费者

[英]Using Supervisor to start Huey (Redis Celery) consumer

I currently have a 'cons.sh' file that's used to start my Huey (a basic version of Celery Redis) Consumer. 我目前有一个“ cons.sh”文件,用于启动Huey(Celery Redis的基本版本)Consumer。

It's contents is as follows: 其内容如下:

#!/bin/bash
echo "smsbot handler"
echo "-------------"
echo "Waiting for tasks'"
echo "Stop the handler using Ctrl+C"
PYTHONPATH=.:$PYTHONPATH huey_consumer.py main.huey --threads=3

Now I'm wanting to use Supervisor to keep this running, but from what it seems, I can't have supervisor start the shell script, I have to have it start a python script. 现在,我想使用Supervisor来保持运行,但是从表面上看,我无法让Supervisor启动shell脚本,而必须让它启动python脚本。

Can anyone tell me how I can start the 'huey_consumer.py' program (given that this is not in my project directory it's part of the huey module) using a python program? 谁能告诉我如何使用python程序启动“ huey_consumer.py”程序(假设它不在我的项目目录中,而是huey模块的一部分)? So that I can start it using supervisor? 这样我就可以使用主管启动它了?

I've been struggling with this for a few days now and I can't for the life of me figure it out. 我已经为此苦苦挣扎了几天,我一生都无法解决。

(if it helps, I'm not using Django with Huey, like most of the other tutorials out there) (如果有帮助的话,我就不会像Huey一样使用Django和Huey)

So basically I need to start: 所以基本上我需要开始:

PYTHONPATH=.:$PYTHONPATH huey_consumer.py main.huey --threads=3

Using supervisor, because at the moment I'm using 'nohup' and that's not exactly ideal! 使用主管,因为此刻我正在使用“ nohup”,这并不完全理想!

改用纯Clery,更好的文档

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM