芹菜在生产中使用主管



我正在尝试使用主管从我的虚拟环境运行芹菜节拍。脚本似乎不起作用

我所有的主管脚本都在目录中/etc/supervisord它有一个supervisord.conf文件和目录conf.d其中包含文件Gorgon-celery.conf

我的supervisord.conf文件如下所示:

[unix_http_server]
file=/tmp/supervisor.sock   ; (the path to the socket file)
[supervisord]
logfile=/var/log/supervisord/main.log ; (main log file;default $CWD/supervisord.log)
logfile_maxbytes=50MB        ; (max main logfile bytes b4 rotation;default 50MB)
logfile_backups=10           ; (num of main logfile rotation backups;default 10)
loglevel=info                ; (log level;default info; others: debug,warn,trace)
pidfile=/tmp/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
nodaemon=false               ; (start in foreground if true;default false)
minfds=1024                  ; (min. avail startup file descriptors;default 1024)
minprocs=200                 ; (min. avail process descriptors;default 200)
childlogdir=/var/log/supervisord            ; ('AUTO' child log dir, default $TEMP)
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl=unix:///tmp/supervisor.sock ; use a unix:// URL  for a unix socket
[include]
files = /etc/supervisord/conf.d/*.conf

我的Gorgon-celery.conf文件如下所示:

[program:Gorgon-celery]
command=cd /home/ubuntu/sites/source && source ../virtualenv/bin/activate && celery -A Gorgon worker
environment=PYTHONPATH=/home/ubuntu/sites/virtualenv/bin
directory=/home/ubuntu/sites/source
numprocs=1
stdout_logfile=/var/log/celeryd/Gorgon.log
stderr_logfile=/var/log/celeryd/Gorgon.log
autostart=true
autorestart=true
startsecs=10
stopwaitsecs = 600
[program:Gorgon-celerybeat]
command=cd /home/ubuntu/sites/source && source ../virtualenv/bin/activate && celery -A Gorgon beat --max-interval=10
environment=PYTHONPATH=/home/ubuntu/sites/virtualenv/bin
directory=/home/ubuntu/sites/source
numprocs=1
stdout_logfile=/var/log/celeryd/Gorgon-beat.log
stderr_logfile=/var/log/celeryd/Gorgon-beat.log
autostart=true
autorestart=true
startsecs=10
stopwaitsecs = 600

最后给主管,我正在使用命令:sudo supervisord -c /etc/supervisord/supervisord.conf

尝试替换

command=cd /home/sourabh_workaholic_gmail_com/sites/source && source ../virtualenv/bin/activate && celery -A Gorgon beat --max-interval=10

command=bash /home/sourabh_workaholic_gmail_com/script.sh

现在在script.sh并放置以下内容:

#!/bin/bash    
cd /home/sourabh_workaholic_gmail_com/sites/source 
source ../virtualenv/bin/activate 
celery -A Gorgon beat --max-interval=10

我怀疑您不能将 source 命令与 supervisorctl 一起使用,因为它不会在 shell 中执行您的命令字符串。 source 是 bash shell 提供的命令,因此我们将命令放在一个 bash 脚本中,它们将在其中工作。

相关内容

  • 没有找到相关文章

最新更新