[supervisord] logfile=/var/log/supervisor/supervisord.log ; 日志文件 logfile_maxbytes=50MB ; 日志文件的大小,默认为 50MB,设置为0则不限制大小 logfile_backups=10; 日志文件保留备份数量,默认为 10,设置为0则不备份 loglevel=info ; 日志级别 pidfile=/var/run/supervisord.pid ; pid文件 nodaemon=false; 是否在前台启动,false -> 以 daemon 方式启动 minfds=1024; 可以打开的文件描述符的最小值 minprocs=200; 可以打开的进程数的最小值 ;umask=022 ; (process file creation umask;default 022) ;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:///var/run/supervisor/supervisor.sock ; 通过UNIX socket连接supervisord,路径与unix_http_server部分的file一致 ;serverurl=http://127.0.0.1:9001 ; 通过HTTP链接 ;username=chris ; should be same as http_username if set ;password=123 ; should be same as http_password if set ;prompt=mysupervisor ; cmd line prompt (default "supervisor") ;history_file=~/.sc_history ; use readline history if available
; The below sample program section shows all possible program subsection values, ; create one or more 'real' program: sections to be able to control them under ; supervisor.
;[program:theprogramname] ; 需要管理的进程的名称 ;command=/bin/cat ; 程序启动的命令 ;process_name=%(program_name)s ; 进程名 ;numprocs=1 ; 需要启动的进程数量 ;directory=/tmp ; 脚本目录 ;umask=022 ; umask for process (default None) ;priority=999 ; 启动优先级 默认为999 值小的优先启动 ;autostart=true ; 在 supervisord 启动的时候启动 (default: true) ;autorestart=true ; 程序退出自动重启 (default: true) ;startsecs=10 ; 启动10秒后没有异常退出,就表示进程正常启动了,默认为1秒 (def. 1) ;startretries=3 ; 启动失败自动重试次数,默认是3 (default 3) ;exitcodes=0,2 ; 'expected' exit codes for process (default 0,2) ;stopsignal=QUIT ; signal used to kill process (default TERM) ;stopwaitsecs=10 ; max num secs to wait b4 SIGKILL (default 10) ;user=chrism ; 用哪个用户启动 ;redirect_stderr=true ; 将stderr重定向到stdout (default false) ;stdout_logfile=/a/path ; 日志输出, NONE for none; default AUTO ;stdout_logfile_maxbytes=1MB ; 日志文件大小 (default 50MB) ;stdout_logfile_backups=10 ; 日志的备份数量 (default 10) ;stdout_capture_maxbytes=1MB ; number of bytes in 'capturemode' (default 0) ;stdout_events_enabled=false ; emit events on stdout writes (default false) ;stderr_logfile=/a/path ; stderr log path, NONE for none; default AUTO ;stderr_logfile_maxbytes=1MB ; max # logfile bytes b4 rotation (default 50MB) ;stderr_logfile_backups=10 ; # of stderr logfile backups (default 10) ;stderr_capture_maxbytes=1MB ; number of bytes in 'capturemode' (default 0) ;stderr_events_enabled=false ; emit events on stderr writes (default false) ;environment=A=1,B=2 ; 环境变量 (def no adds) ;serverurl=AUTO ; override serverurl computation (childutils)
; 对子进程的监控,当进程异常退出时告警
;[eventlistener:theeventlistenername] ;command=/bin/eventlistener ; the program (relative uses PATH, can take args) ;process_name=%(program_name)s ; process_name expr (default %(program_name)s) ;numprocs=1 ; number of processes copies to start (def 1) ;events=EVENT ; event notif. types to subscribe to (req'd) ;buffer_size=10 ; event buffer queue size (default 10) ;directory=/tmp ; directory to cwd to before exec (def no cwd) ;umask=022 ; umask for process (default None) ;priority=-1 ; the relative start priority (default -1) ;autostart=true ; start at supervisord start (default: true) ;autorestart=unexpected ; restart at unexpected quit (default: unexpected) ;startsecs=10 ; number of secs prog must stay running (def. 1) ;startretries=3 ; max # of serial start failures (default 3) ;exitcodes=0,2 ; 'expected' exit codes for process (default 0,2) ;stopsignal=QUIT ; signal used to kill process (default TERM) ;stopwaitsecs=10 ; max num secs to wait b4 SIGKILL (default 10) ;user=chrism ; setuid to this UNIX account to run the program ;redirect_stderr=true ; redirect proc stderr to stdout (default false) ;stdout_logfile=/a/path ; stdout log path, NONE for none; default AUTO ;stdout_logfile_maxbytes=1MB ; max # logfile bytes b4 rotation (default 50MB) ;stdout_logfile_backups=10 ; # of stdout logfile backups (default 10) ;stdout_events_enabled=false ; emit events on stdout writes (default false) ;stderr_logfile=/a/path ; stderr log path, NONE for none; default AUTO ;stderr_logfile_maxbytes=1MB ; max # logfile bytes b4 rotation (default 50MB) ;stderr_logfile_backups ; # of stderr logfile backups (default 10) ;stderr_events_enabled=false ; emit events on stderr writes (default false) ;environment=A=1,B=2 ; process environment additions ;serverurl=AUTO ; override serverurl computation (childutils)
; 将多个文件组合成一个组
;[group:thegroupname] ;programs=progname1,progname2 ; each refers to 'x' in [program:x] definitions ;priority=999 ; the relative start priority (default 999)
● supervisord.service - Process Monitoring and Control Daemon Loaded: loaded (/usr/lib/systemd/system/supervisord.service; enabled; vendor preset: disabled) Active: failed (Result: exit-code) since Thu 2021-04-15 22:49:51 CST; 6s ago Process: 27052 ExecStart=/usr/bin/supervisord -c /etc/supervisord.conf (code=exited, status=2)
Apr 15 22:49:50 iFan systemd[1]: Starting Process Monitoring and Control Daemon... Apr 15 22:49:51 iFan supervisord[27052]: Error: Another program is already listening on a port that one of our HTT...isord. Apr 15 22:49:51 iFan supervisord[27052]: For help, use /usr/bin/supervisord -h Apr 15 22:49:51 iFan systemd[1]: supervisord.service: control process exited, code=exited status=2 Apr 15 22:49:51 iFan systemd[1]: Failed to start Process Monitoring and Control Daemon. Apr 15 22:49:51 iFan systemd[1]: Unit supervisord.service entered failed state. Apr 15 22:49:51 iFan systemd[1]: supervisord.service failed. Hint: Some lines were ellipsized, use -l to show in full.