=====================主配置文件======================== [unix_http_server]
file=/tmp/supervisor.sock ; UNIX socket 文件,supervisorctl 会使用
;chmod=0700 ; socket 文件的 mode,默认是 0700
;chown=nobody:nogroup ; socket 文件的 owner,格式: uid:gid
;[inet_http_server] ; HTTP 服务器,提供 web 管理界面
;port=127.0.0.1:9001 ; Web 管理后台运行的 IP 和端口,如果开放到公网,需要注意安全性
;username=user ; 登录管理后台的用户名
;password=123 ; 登录管理后台的密码
[supervisord]
logfile=/tmp/supervisord.log ; 日志文件,默认是 $CWD/supervisord.log
logfile_maxbytes=50MB ; 日志文件大小,超出会 rotate,默认 50MB
logfile_backups=10 ; 日志文件保留备份数量默认 10
loglevel=info ; 日志级别,默认 info,其它: debug,warn,trace
pidfile=/tmp/supervisord.pid ; pid 文件
nodaemon=false ; 是否在前台启动,默认是 false,即以 daemon 的方式启动
minfds=1024 ; 可以打开的文件描述符的最小值,默认 1024
minprocs=200 ; 可以打开的进程数的最小值,默认 200
; 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 ; 通过 UNIX socket 连接 supervisord,路径与 unix_http_server 部分的 file 一致
;serverurl=http://127.0.0.1:9001 ; 通过 HTTP 的方式连接 supervisord
; 包含其他的配置文件
[include]
files = /etc/supervisor/conf.d/*.conf ; 可以是 *.conf 或 *.ini
=====================单独进程控制文件========================
[program:album_app.js]
directory = /data/album ;程序的启动目录
command=nodejs app.js ;启动命令
user = root ;启动用户
autostart=true ;在 supervisord 启动的时候也自动启动
startsecs=2 ;启动2秒后没有异常退出,就当作已经正常启动了
autorestart=true ; 程序异常退出后自动重启
redirect_stderr=true ; 把 stderr 重定向到 stdout,默认 false
stopsignal=INT
stdout_logfile=/data/logs/err.log
stderr_logfile_maxbytes=1MB ; stdout 日志文件大小,默认 50MB
stderr_logfile_backups=10 ; stdout 日志文件备份数
stderr_capture_maxbytes=1MB
stderr_events_enabled=false |