supervisor 安装和配置

1,下载

pip2 install supervisor

 

2,把supervisor的配置文件放到一个地方

echo_supervisord_conf >/etc/supervisord.cof

3,在include位置配置files文件时,

[include]        ;先把前面的;(注释符号去掉)
files=/etc/*.ini     ;这里注意,如果只写某一个文件,那么只会匹配最后一个
                           ;所以这里要用*配置文件
                 

4,配置文件

[program:data_beat]
command=celery -A data_center.celery beat -l info

directory=/home/panyu/Downloads/project/data_center/ 
autostart=true
autorestart=true
startsecs=3 
redirect_stderr=true
stdout_logfile=/home/panyu/Downloads/project/data_center/risk/celery.log

[program:data_beat]
command=/home/panyu/virtualenvs/bin/celery -A data_center.celery beat -l info ;这个celery要指向的地方是虚拟环境内部下载的celery地址
directory=/home/panyu/Downloads/project/data_center/  ;值的是项目根目录
autostart=true   
autorestart=true
startsecs=3 
redirect_stderr=true
stdout_logfile=/home/panyu/Downloads/project/data_center/risk/celery.log

 

 

 

 

[program:open_search]
command=/home/s/www/fukun/gopath/src/open_search/open_search ;需要执行的命令
directory=/home/s/www/fukun/gopath/src/open_search/ ; directory to cwd to before exec (def no cwd)
autostart=true ; start at supervisord start (default: true)
autorestart=true ; whether/when to restart (default: unexpected)
startsecs=3 ; number of secs prog must stay running (def. 1)
redirect_stderr=true ; redirect proc stderr to stdout (default false) 错误输出重定向
stdout_logfile=/tmp/open_search_gorun.log ; stdout log path, NONE for none; default AUTO, log输出
stdout_logfile_maxbytes=20MB ;默认日志文件大小为20M

[program:zhoujy] #说明同上 directory=/opt/bin command=/usr/bin/python /opt/bin/zhoujy.py autostart=true autorestart=false stderr_logfile=/tmp/zhoujy_stderr.log stdout_logfile=/tmp/zhoujy_stdout.log #user = zhoujy  

 

posted @ 2018-05-16 21:21  forjie  阅读(99)  评论(0)    收藏  举报