; 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]; 这个选项是给XML_RPC用的 supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
; The below sample eventlistener section shows all possible ; eventlistener subsection values, create one or more 'real' ; eventlistener: sections to be able to handle event notifications ; sent by supervisor. ; 下面是事件监听器的可选配置, supervisor能够处理事件通知. ; eventlistener和program的地位是一样的,也是suopervisor启动的子进程,配置和program相似 ; listener的实现可以参考这篇文章 https://www.haoyizebo.com/posts/7f55f825/
;[eventlistener:theeventlistenername] ;command=/bin/eventlistener ; 运行的程序 (相对使用PATH路径, 可以使用参数) ;process_name=%(program_name)s ; 进程名表达式,默认为%(program_name)s ;numprocs=1 ; 默认启动的进程数目,默认为1 ;events=EVENT ; event事件的类型,comma-separated,只有写在这个地方的事件类型才会被发送 ;buffer_size=10 ; 事件缓冲区队列大小,默认10 ;directory=/tmp ; 在运行前cwd到指定的目录,默认不执行cmd ;umask=022 ; 进程umask,默认None ;priority=-1 ; 程序运行的优先级,默认-1 ;autostart=true ; 默认随supervisord自动启动,默认true ;autorestart=unexpected ; whether/when to restart (default: unexpected) ;startsecs=1 ; number of secs prog must stay running (def. 1) ;startretries=3 ; max # of serial start failures (default 3) ;exitcodes=0,2 ; 期望的退出码,默认0,2 ;stopsignal=QUIT ; 杀死进程的信号,默认TERM ;stopwaitsecs=10 ; max num secs to wait b4 SIGKILL (default 10) ;stopasgroup=false ; 向unix进程组发送停止信号,默认false ;killasgroup=false ; 向unix进程组发送SIGKILL信号,默认false ;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)
; The below sample group section shows all possible group values, ; create one or more 'real' group: sections to create "heterogeneous" ; process groups. ; 下面是进程组的可选配置,可以创建一个或多个进程组。 ; 注意:program被划分到组里面之后,就相当于原来的配置从supervisor的配置文件里消失了, ; supervisor只会对组进行管理,而不再会对组里面的单个program进行管理了
[group:appgroup] programs=wapp,wfapp ; 这里的进程名是上文 [program:x] 的 x ;priority=999 ; 程序运行的优先级,默认999
; The [include] section can just contain the "files" setting. This ; setting can list multiple files (separated by whitespace or ; newlines). It can also contain wildcards. The filenames are ; interpreted as relative to this file. Included files *cannot* ; include files themselves. ; 这个东西挺有用的,当我们要管理的进程很多的时候,写在一个文件里面就有点大了。 ; 我们可以把配置信息写到多个文件中,然后include过来
$ supersivord /usr/lib/python2.7/site-packages/supervisor-3.1.3-py2.7.egg/supervisor/options.py:296: UserWarning: Supervisord is running as root and it is searching for its configuration file in default locations (including its current working directory); you probably want to specify a "-c" argument specifying an absolute path to a configuration file for improved security. 'Supervisord is running as root and it is searching ' Error: The directory named as part of the path /data/log/supervisor/main.log does not exist. For help, use /usr/bin/supervisord -h
这个目录/data/log/supervisor/不存在,手动创建就好了
1 2
/usr/lib/python2.7/site-packages/supervisor-3.1.3-py2.7.egg/supervisor/options.py:296: UserWarning: Supervisord is running as root and it is searching for its configuration file in default locations (including its current working directory); you probably want to specify a "-c" argument specifying an absolute path to a configuration file for improved security. 'Supervisord is running as root and it is searching '
使用supervisord -c /etc/supervisord.conf启动
1 2
$ supervisorctl unix:///var/run/supervisor.sock no such file