安装

# 关于fabenv,一般是在安装了python2.7之后,virtualenv出来的,参考python 2.7部署
fabenv
pip install  -i http://pypi.douban.com/simple  supervisor

or 

yum -y install supervisord --enablerepo=epel

配置

主配置文件 /etc/supervisord.conf

[unix_http_server]
file=/tmp/supervisor.sock   ; (the path to the socket file)

[inet_http_server]         ; inet (TCP) server disabled by default
port=0.0.0.0:1009       ; (ip_address:port specifier, *:port for all iface)
username=ops              ; (default is no username (open server))
password=123             ; (default is no password (open server))

[supervisord]
environment=LC_ALL='zh_CN.UTF-8',LANG='zh_CN.UTF-8' 
logfile=/tmp/supervisord.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=debug                ; (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)

[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/supervisor.d/*.conf

子配置文件

[program:123]
priority=1 ; 数字越小,优先级越小,最先启动
command=/usr/local/123/bin/start2.sh
# 如果是其他用户,那么就用下面的进行切换,要不然使用user变量的话对于环境变量会有问题(例如,不读取/etc/profile bashrc啥问题的)
# command=/bin/su - public -c "/home/public/App/app"
directory=/usr/local/123/bin/
autostart=true
autorestart=true
startretries=100
exitcodes=0,2 ;也是默认的数字
stopsignal=TERM ; 这个最狠,是10,我们都知道kill -9 这个更牛逼~
stopasgroup=true        ; 是否想UNIX进程组发送结束信号 (default false)
killasgroup=true             ; SIGKILL UNIX 进
stderr_logfile=/data/logs/123.error.log
stdout_logfile=/data/logs/123.info.log
Copyright © opschina.org 2017 with zzlyzq@gmail.com all right reserved,powered by Gitbook该文件修订时间: 2017-07-11 11:32:48

results matching ""

    No results matching ""