用supervisor控制celery时的脚本
生活随笔
收集整理的這篇文章主要介紹了
用supervisor控制celery时的脚本
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
注意啟停的先后順序及判斷即可。
這樣,在更改task之后,要重啟就方便很多啦。。
#!/bin/sh supervisord_count=`ps -elf | grep celery | grep -v grep | wc -l` ]; then fi celery_count=`ps -elf | grep celery | grep -v grep | wc -l` ]; then fi /usr/bin/python /usr/local/python27/bin/supervisord -c /P/supervisord_prd.conf sh /usr/local/nginx/sbin/uwsgi9090 reload /usr/local/nginx/sbin/nginx -s reload echo 'finished!'
另給一個最基本的supervisor的設置:
; Sample supervisor config file.
;
; For more information on the config file, please see:
; http://supervisord.org/configuration.html
;
; Notes:
; - Shell expansion ("~" or "$HOME") is not supported. Environment
; variables can be expanded using this syntax: "%(ENV_HOME)s".
; - Comments must have a leading space: "a=b ;comment" not "a=b;comment".
[supervisord]
logfile=/tmp/supervisord.log ; (main log file;default $CWD/supervisord.log)
logfile_maxbytes=50MB ; (max main logfile bytes b4 rotation;default 50MB)
logfile_backups= ; (num of main logfile rotation backups;default )
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= ; (min. avail startup )
minprocs= ; (min. avail process descriptors;default )
;umask= ; (process )
;user=chrism ; (default is current user, required if root)
;identifier=supervisor ; (supervisord identifier, default is 'supervisor')
;directory=/tmp ; (default is not to cd during start)
;nocleanup=true ; (don't clean up tempfiles at start;default false)
;childlogdir=/tmp ; ('AUTO' child log dir, default $TEMP)
;environment=KEY="value" ; (key value pairs to add to environment)
;strip_ansi=false ; (strip ansi escape codes in logs; def. false)
; the below section must remain in the config file for RPC
; (supervisorctl/web interface) to work, additional interfaces may be
; added by defining them in separate rpcinterface: sections
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl=unix:///tmp/supervisor.sock ; use a unix:// URL for a unix socket
[program:celeryd]
command=/usr/local/python27/bin/celery worker -A XXXX -c -l INFO -n celeryd@deploy
stdout_logfile=/var/log/celeryd.log
stderr_logfile=/var/log/celeryd.log
autostart=true
autorestart=true
startsecs=
stopwaitsecs=
;[program:celerybeat]
;command=/usr/local/python27/bin/celery worker -A XXXX -c -B -n celerybeat@ping
;stdout_logfile=/var/log/celeryd.log
;stderr_logfile=/var/log/celeryd.log
;autostart=true
;autorestart=true
;startsecs=
;stopwaitsecs=
總結
以上是生活随笔為你收集整理的用supervisor控制celery时的脚本的全部內容,希望文章能夠幫你解決所遇到的問題。