supervisor

supervisor管理进程,是通过fork/exec的方式将这些被管理的进程当作supervisor的子进程来启动,所以我们只需要将要管理进程的可执行文件的路径添加到supervisor的配置文件中就好了。此时被管理进程被视为supervisor的子进程,若该子进程异常中断,则父进程可以准确的获取子进程异常中断的信息,通过在配置文件中设置autostart=ture,可以实现对异常中断的子进程的自动重启。


安装supervisor

$ sudo apt-get install supervisor

配置文件

安装完supervisor后,输入以下命令可得到配置文件:

$ echo_supervisord_conf

或者:

$ cat /etc/supervisord/supervisord.conf

配置文件如下(分号;表示注释):

; supervisor config file

[unix_http_server]
file=/var/run/supervisor.sock   ; (the path to the socket file)
chmod=0700                       ; sockef file mode (default 0700)

[supervisord]
logfile=/var/log/supervisor/supervisord.log ; (main log file;default $CWD/supervisord.log)
pidfile=/var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
childlogdir=/var/log/supervisor            ; ('AUTO' child log dir, default $TEMP)

; 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.sock ; use a unix:// URL  for a unix socket

; 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]
files = /etc/supervisor/conf.d/*.conf

以上配置文件用到几个部分:

  • [unix_http_server]:这部分设置HTTP服务器监听的UNIX domain socket
    • file: 指向UNIX domain socket,即file=/var/run/supervisor.sock
    • chmod:启动时改变supervisor.sock的权限
  • [supervisord]:与supervisord有关的全局配置需要在这部分设置
    • logfile: 指向记录supervisord进程的log文件
    • pidfile:pidfile保存子进程的路径
    • childlogdir:子进程log目录设为AUTO的log目录
  • [supervisorctl]:
    • serverurl:进入supervisord的URL, 对于UNIX domain sockets, 应设为 unix:///absolute/path/to/file.sock
  • [include]:如果配置文件包含该部分,则该部分必须包含一个files键:
    • files:包含一个或多个文件,这里包含了/etc/supervisor/conf.d/目录下所有的.conf文件,可以在该目录下增加我们自己的配置文件,在该配置文件中增加[program:x]部分,用来运行我们自己的程序,如下:
  • [program:x]:配置文件必须包括至少一个program,x是program名称,必须写上,不能为空
    • command:包含一个命令,当这个program启动时执行
    • directory:执行子进程时supervisord暂时切换到该目录
    • user:账户名
    • startsecs:进程从STARING状态转换到RUNNING状态program所需要保持运行的时间(单位:秒)
    • redirect_stderr:如果是true,则进程的stderr输出被发送回其stdout文件描述符上的supervisord
    • stdout_logfile:将进程stdout输出到指定文件
    • stdout_logfile_maxbytes:stdout_logfile指定日志文件最大字节数,默认为50MB,可以加KB、MB或GB等单位
    • stdout_logfile_backups:要保存的stdout_logfile备份的数量

示例如下,在目录/etc/supervisor/conf.d/下创建awesome.conf,并加入:

;/etc/supervisor/conf.d/awesome.conf

[program:awesome]

command     = /usr/bin/env python3 /srv/awesome/www/app.py
directory   = /srv/awesome/www
user        = www-data
startsecs   = 3

redirect_stderr         = true
stdout_logfile_maxbytes = 50MB
stdout_logfile_backups  = 10
stdout_logfile          = /srv/awesome/log/app.log

配置完后,先进入/srv/awesome/目录下创建log目录,之后启动supervisor:

$ sudo supervisord -c supervisor.conf  

supervisor基本命令(后四个命令可以省略“-c supervisor.conf”):

supervisord -c supervisor.conf                       通过配置文件启动supervisor
supervisorctl -c supervisor.conf status              查看状态
supervisorctl -c supervisor.conf reload              重新载入配置文件
supervisorctl -c supervisor.conf start [all]|[x]     启动所有/指定的程序进程
supervisorctl -c supervisor.conf stop [all]|[x]      关闭所有/指定的程序进程 

执行服务(运行app.py):

$ sudo supervisorctl start awesome

如果supervisor遇到错误,可以在/var/log/supervisor/supervisord.log中查看日志;
如果app运行出现问题,可以在/srv/awesome/log/app.log中查看日志。

Supervisor(http://supervisord.org/)是用Python开发的一个client/server服务,是Linux/Unix系统下的一个进程管理工具,不支持Windows系统。它可以很方便的监听、启动、停止、重启一个或多个进程。用Supervisor管理的进程,当一个进程意外被杀死,supervisort监听到进程死后,会自动将它重新拉起,很方便的做到进程自动恢复的功能,不再需要自己写shell脚本来控制。

因为Supervisor是Python开发的,安装前先检查一下系统否安装了Python2.4以上版本。下面以CentOS7,Python2.7版本环境下,介绍Supervisor的安装与配置步聚:

1、安装Python包管理工具(easy_install)
easy_install是setuptools包里带的一个命令,使用easy_install实际上是在调用setuptools来完成安装模块的工作,所以安装setuptools即可。
1
wget --no-check-certificate https://bootstrap.pypa.io/ez_setup.py -O - | sudo python
1
2、安装supervisor
easy_install supervisor
1
supervisor安装完成后会生成三个执行程序:supervisortd、supervisorctl、echo_supervisord_conf,分别是supervisor的守护进程服务(用于接收进程管理命令)、客户端(用于和守护进程通信,发送管理进程的指令)、生成初始配置文件程序。

3、配置
运行supervisord服务的时候,需要指定supervisor配置文件,如果没有显示指定,默认在以下目录查找:

$CWD/supervisord.conf
$CWD/etc/supervisord.conf
/etc/supervisord.conf
/etc/supervisor/supervisord.conf (since Supervisor 3.3.0)
../etc/supervisord.conf (Relative to the executable)
../supervisord.conf (Relative to the executable)
1
2
3
4
5
6
$CWD表示运行supervisord程序的目录。

可以通过运行echo_supervisord_conf程序生成supervisor的初始化配置文件,如下所示:

mkdir /etc/supervisor
echo_supervisord_conf > /etc/supervisor/supervisord.conf
1
2
4、配置文件参数说明
supervisor的配置参数较多,下面介绍一下常用的参数配置,详细的配置及说明,请参考官方文档介绍。 
注:分号(;)开头的配置表示注释

[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,如果设成0,表示不限制大小
logfile_backups=10           ;日志文件保留备份数量默认10,设为0表示不备份
loglevel=info                ;日志级别,默认info,其它: debug,warn,trace
pidfile=/tmp/supervisord.pid ;pid 文件
nodaemon=false               ;是否在前台启动,默认是false,即以 daemon 的方式启动
minfds=1024                  ;可以打开的文件描述符的最小值,默认 1024
minprocs=200                 ;可以打开的进程数的最小值,默认 200

[supervisorctl]
serverurl=unix:///tmp/supervisor.sock ;通过UNIX socket连接supervisord,路径与unix_http_server部分的file一致
;serverurl=http://127.0.0.1:9001 ; 通过HTTP的方式连接supervisord

; [program:xx]是被管理的进程配置参数,xx是进程的名称
[program:xx]
command=/opt/apache-tomcat-8.0.35/bin/catalina.sh run  ; 程序启动命令
autostart=true       ; 在supervisord启动的时候也自动启动
startsecs=10         ; 启动10秒后没有异常退出,就表示进程正常启动了,默认为1秒
autorestart=true     ; 程序退出后自动重启,可选值:[unexpected,true,false],默认为unexpected,表示进程意外杀死后才重启
startretries=3       ; 启动失败自动重试次数,默认是3
user=tomcat          ; 用哪个用户启动进程,默认是root
priority=999         ; 进程启动优先级,默认999,值小的优先启动
redirect_stderr=true ; 把stderr重定向到stdout,默认false
stdout_logfile_maxbytes=20MB  ; stdout 日志文件大小,默认50MB
stdout_logfile_backups = 20   ; stdout 日志文件备份数,默认是10
; stdout 日志文件,需要注意当指定目录不存在时无法正常启动,所以需要手动创建目录(supervisord 会自动创建日志文件)
stdout_logfile=/opt/apache-tomcat-8.0.35/logs/catalina.out
stopasgroup=false     ;默认为false,进程被杀死时,是否向这个进程组发送stop信号,包括子进程
killasgroup=false     ;默认为false,向进程组发送kill信号,包括子进程

;包含其它配置文件
[include]
files = relative/directory/*.ini    ;可以指定一个或多个以.ini结束的配置文件
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
include示例:

[include]
files = /opt/absolute/filename.ini /opt/absolute/*.ini foo.conf config??.ini
1
2
5、配置管理进程
进程管理配置参数,不建议全都写在supervisord.conf文件中,应该每个进程写一个配置文件放在include指定的目录下包含进supervisord.conf文件中。 
1> 创建/etc/supervisor/config.d目录,用于存放进程管理的配置文件 
2> 修改/etc/supervisor/supervisord.conf中的include参数,将/etc/supervisor/conf.d目录添加到include中

[include]
files = /etc/supervisor/config.d/*.ini
1
2


下面是配置Tomcat进程的一个例子:

[program:tomcat]
command=/opt/apache-tomcat-8.0.35/bin/catalina.sh run
stdout_logfile=/opt/apache-tomcat-8.0.35/logs/catalina.out
autostart=true
autorestart=true
startsecs=5
priority=1
stopasgroup=true
killasgroup=true
1
2
3
4
5
6
7
8
9
5、启动Supervisor服务
supervisord -c /etc/supervisor/supervisord.conf
1
6、控制进程
6.1 交互终端
supervisord启动成功后,可以通过supervisorctl客户端控制进程,启动、停止、重启。运行supervisorctl命令,不加参数,会进入supervisor客户端的交互终端,并会列出当前所管理的所有进程。 


上图中的tomcat就是我们在配置文件中[program:tomcat]指定的名字。
1
输入help可以查看可以执行的命令列表,如果想看某个命令的作用,运行help 命令名称,如:help stop

stop tomcat  // 表示停止tomcat进程
stop all     // 表示停止所有进程
// ...
1
2
3
6.2 bash终端
supervisorctl status
supervisorctl stop tomcat
supervisorctl start tomcat
supervisorctl restart tomcat
supervisorctl reread
supervisorctl update
1
2
3
4
5
6
6.3 Web管理界面
 
出于安全考虑,默认配置是没有开启web管理界面,需要修改supervisord.conf配置文件打开http访权限,将下面的配置:

;[inet_http_server]         ; inet (TCP) server disabled by default
;port=127.0.0.1:9001        ; (ip_address:port specifier, *:port for all iface)
;username=user              ; (default is no username (open server))
;password=123               ; (default is no password (open server))
1
2
3
4
修改成:

[inet_http_server]         ; inet (TCP) server disabled by default
port=0.0.0.0:9001          ; (ip_address:port specifier, *:port for all iface)
username=user              ; (default is no username (open server))
password=123               ; (default is no password (open server))
1
2
3
4
port:绑定访问IP和端口,这里是绑定的是本地IP和9001端口 
username:登录管理后台的用户名 
password:登录管理后台的密码

7、开机启动Supervisor服务
7.1 配置systemctl服务
1> 进入/lib/systemd/system目录,并创建supervisor.service文件

[Unit]
Description=supervisor
After=network.target

[Service]
Type=forking
ExecStart=/usr/bin/supervisord -c /etc/supervisor/supervisord.conf
ExecStop=/usr/bin/supervisorctl $OPTIONS shutdown
ExecReload=/usr/bin/supervisorctl $OPTIONS reload
KillMode=process
Restart=on-failure
RestartSec=42s

[Install]
WantedBy=multi-user.target
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
2> 设置开机启动

systemctl enable supervisor.service
systemctl daemon-reload
1
2
3、修改文件权限为766

chmod 766 supervisor.service
1
7.2 配置service类型服务
#!/bin/bash
#
# supervisord   This scripts turns supervisord on
#
# Author:       Mike McGrath <mmcgrath@redhat.com> (based off yumupdatesd)
#
# chkconfig:    - 95 04
#
# description:  supervisor is a process control utility.  It has a web based
#               xmlrpc interface as well as a few other nifty features.
# processname:  supervisord
# config: /etc/supervisor/supervisord.conf
# pidfile: /var/run/supervisord.pid
#

# source function library
. /etc/rc.d/init.d/functions

RETVAL=0

start() {
    echo -n $"Starting supervisord: "
    daemon "supervisord -c /etc/supervisor/supervisord.conf "
    RETVAL=$?
    echo
    [ $RETVAL -eq 0 ] && touch /var/lock/subsys/supervisord
}

stop() {
    echo -n $"Stopping supervisord: "
    killproc supervisord
    echo
    [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/supervisord
}

restart() {
    stop
    start
}

case "$1" in
  start)
    start
    ;;
  stop) 
    stop
    ;;
  restart|force-reload|reload)
    restart
    ;;
  condrestart)
    [ -f /var/lock/subsys/supervisord ] && restart
    ;;
  status)
    status supervisord
    RETVAL=$?
    ;;
  *)
    echo $"Usage: $0 {start|stop|status|restart|reload|force-reload|condrestart}"
    exit 1
esac

exit $RETVAL
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
将上述脚本内容保存到/etc/rc.d/init.d/supervisor文件中,修改文件权限为755,并设置开机启动

chmod 755 /etc/rc.d/init.d/supervisor
chkconfig supervisor on
1
2
注意:修改脚本中supervisor配置文件路径为你的supervisor的配置文件路径

其它Linux发行版开机启动脚本:https://github.com/Supervisor/initscripts

注意:
Supervisor只能管理非daemon的进程,也就是说Supervisor不能管理守护进程。否则提示Exited too quickly (process log may have details)异常。例子中的Tomcat默认是以守护进程启动的,所以我们改成了catalina.sh run,以前台进程的方式运行。

yum方式安装

yum install epel-release
yum install -y supervisor
1
2
supervisor没有发布在标准的CentOS源在,需要安装epel源。这种方式安装的可能不是最新版本,但比较方便,安装完成之后,配置文件会自动帮你生成。 
默认配置文件:/etc/supervisord.conf 
进程管理配置文件放到:/etc/supervisord.d/目录下即可

默认日志文件:/tmp/supervisord.log,可以查看进程的启动信息

本文中,我们将会详细介绍supervisord的使用。

supervisord的简介

title 
Supervisor是一个C/S系统,允许其用户监视和控制类UNIX操作系统上的大量进程。 
很多时候,我们想要在后台运行一个程序时,通常会用到nohup等命令。 
但是类似于nohup这样的命令并不能完整的控制和监控进程。 
而supervisord则是一个完整了监视和控制服务的工具。

安装

supervisord本身是基于Python开发的。 
因此,在使用supervisord时,我们首先需要安装Python。 
当Python安装完成后,通常会自带了Python的包管理工具pip。 
接下来,我们可以使用pip命令来安装supervisord。

 
  1. pip install supervisor

安装完成后,我们可以测试一下是否已经安装完成:

 
  1. supervisord --help

正常情况下我们可以看到如下内容: 
title

配置文件说明

在命令行中执行如下命令:

 
  1. echo_supervisord_conf

可以看到在标准输出中输出了一份标准的配置文件模板。 
我们可以将其重定向到某个文件中,从而生成一个配置文件。 
示例:

 
  1. echo_supervisord_conf > /home/nianshi/supervisor/conf/supervisord.conf

此时,我们将会得到一个文件/home/nianshi/supervisor/conf/supervisord.conf

下面我们来浅谈一下配置文件的内容: 
从上至下,依次包括如下Section:

  1. unix_http_server,其中,file指定了socket file的位置。
  2. inet_http_server,用于启动一个含有前端的服务,可以从Web页面中管理服务。其中,port用于设置访问地址,username和password用于设置授权认证。
  3. supervisord是对管理服务本身的配置。包含日志文件相关、进程文件、启动方式等等。
  4. rpcinterface:supervisor中包含了rpc相关的接口。
  5. supervisorctl是对supervisorctl服务相关的配置。
  6. program是真正配置需要管理的任务。
  7. eventlistener是对事件进行的管理。
  8. group可以实现对任务组的管理。
  9. include中可以引用其他的配置文件。

推荐方法: 
将系统相关配置文件写在一个配置文件中,而在这个配置文件中的include Section中引入一个文件夹。具体的服务管理机制则针对每个任务单独编写文件。

示例: 
supervisord.conf文件:

 
  1. [unix_http_server]
  2. file=/tmp/supervisor.sock
  3.  
  4. [inet_http_server]
  5. port=*:9001
  6. username=user
  7. password=123
  8.  
  9. [supervisord]
  10. logfile=/tmp/supervisord.log ; main log file; default $CWD/supervisord.log
  11. logfile_maxbytes=50MB ; max main logfile bytes b4 rotation; default 50MB
  12. logfile_backups=10 ; # of main logfile backups; 0 means none, default 10
  13. loglevel=info ; log level; default info; others: debug,warn,trace
  14. pidfile=/tmp/supervisord.pid ; supervisord pidfile; default supervisord.pid
  15. nodaemon=false ; start in foreground if true; default false
  16. minfds=1024 ; min. avail startup file descriptors; default 1024
  17. minprocs=200 ; min. avail process descriptors;default 200
  18.  
  19. [rpcinterface:supervisor]
  20. supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
  21.  
  22. [supervisorctl]
  23. serverurl=unix:///tmp/supervisor.sock ; use a unix:// URL for a unix socket
  24.  
  25. [include]
  26. files = /etc/supervisord.d/*.ini

/etc/supervisord.d/logstash.ini

 
  1. [program:nianshi_logstash]
  2. command=/root/logstash/logstash-6.2.2/bin/logstash -f /root/logstash/conf/logstash.conf
  3. startsecs=3
  4. user=root
  5. stdout_logfile=/root/logstash/log/stdout.log
  6. stderr_logfile=/root/logstash/log/stderr.log
  7. environment=PYTHONPATH=$PYTHONPATH:/home/wangzhe/bcm-onlinecheck/alarm-online-check
  8. directory=/home/wangzhe/bcm-onlinecheck/alarm-online-check

启动

当我们完成配置文件的准备后,就可以启动supervisord服务了。

 
  1. supervisord -c /home/nianshi/supervisor/conf/supervisord.conf

其中,-c用于指定配置文件。 
当发生错误时,我们可以使用-n参数运行从而可以在前端运行,方便定位原因。

服务管理

除了使用supervisord进行服务启动外,针对单独的服务,我们还可以使用supervisorctl进行服务管理。 
例如:

  1. 启动指定的服务
 
  1. supervisorctl start test123
  1. 停止指定的服务
 
  1. supervisorctl stop test123
  1. 更新配置文件变化并重启变化的服务
 
  1. supervisorctl update

Web图形管理页面

如果我们在配置文件中配置了inet_http_server,那么我们可以通过前端页面进行任务监控与管理。 
访问指定的端口地址,可以看到页面如下所示: 
title

完整配置文件

完整的Demo配置文件如下:

 
  1. ; Sample supervisor config file.
  2. ;
  3. ; For more information on the config file, please see:
  4. ; http://supervisord.org/configuration.html
  5. ;
  6. ; Notes:
  7. ; - Shell expansion ("~" or "$HOME") is not supported. Environment
  8. ; variables can be expanded using this syntax: "%(ENV_HOME)s".
  9. ; - Quotes around values are not supported, except in the case of
  10. ; the environment= options as shown below.
  11. ; - Comments must have a leading space: "a=b ;comment" not "a=b;comment".
  12. ; - Command will be truncated if it looks like a config file comment, e.g.
  13. ; "command=bash -c 'foo ; bar'" will truncate to "command=bash -c 'foo ".
  14.  
  15. [unix_http_server]
  16. file=/tmp/supervisor.sock ; the path to the socket file
  17. ;chmod=0700 ; socket file mode (default 0700)
  18. ;chown=nobody:nogroup ; socket file uid:gid owner
  19. ;username=user ; default is no username (open server)
  20. ;password=123 ; default is no password (open server)
  21.  
  22. ;[inet_http_server] ; inet (TCP) server disabled by default
  23. ;port=127.0.0.1:9001 ; ip_address:port specifier, *:port for all iface
  24. ;username=user ; default is no username (open server)
  25. ;password=123 ; default is no password (open server)
  26.  
  27. [supervisord]
  28. logfile=/tmp/supervisord.log ; main log file; default $CWD/supervisord.log
  29. logfile_maxbytes=50MB ; max main logfile bytes b4 rotation; default 50MB
  30. logfile_backups=10 ; # of main logfile backups; 0 means none, default 10
  31. loglevel=info ; log level; default info; others: debug,warn,trace
  32. pidfile=/tmp/supervisord.pid ; supervisord pidfile; default supervisord.pid
  33. nodaemon=false ; start in foreground if true; default false
  34. minfds=1024 ; min. avail startup file descriptors; default 1024
  35. minprocs=200 ; min. avail process descriptors;default 200
  36. ;umask=022 ; process file creation umask; default 022
  37. ;user=chrism ; default is current user, required if root
  38. ;identifier=supervisor ; supervisord identifier, default is 'supervisor'
  39. ;directory=/tmp ; default is not to cd during start
  40. ;nocleanup=true ; don't clean up tempfiles at start; default false
  41. ;childlogdir=/tmp ; 'AUTO' child log dir, default $TEMP
  42. ;environment=KEY="value" ; key value pairs to add to environment
  43. ;strip_ansi=false ; strip ansi escape codes in logs; def. false
  44.  
  45. ; The rpcinterface:supervisor section must remain in the config file for
  46. ; RPC (supervisorctl/web interface) to work. Additional interfaces may be
  47. ; added by defining them in separate [rpcinterface:x] sections.
  48.  
  49. [rpcinterface:supervisor]
  50. supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
  51.  
  52. ; The supervisorctl section configures how supervisorctl will connect to
  53. ; supervisord. configure it match the settings in either the unix_http_server
  54. ; or inet_http_server section.
  55.  
  56. [supervisorctl]
  57. serverurl=unix:///tmp/supervisor.sock ; use a unix:// URL for a unix socket
  58. ;serverurl=http://127.0.0.1:9001 ; use an http:// url to specify an inet socket
  59. ;username=chris ; should be same as in [*_http_server] if set
  60. ;password=123 ; should be same as in [*_http_server] if set
  61. ;prompt=mysupervisor ; cmd line prompt (default "supervisor")
  62. ;history_file=~/.sc_history ; use readline history if available
  63.  
  64. ; The sample program section below shows all possible program subsection values.
  65. ; Create one or more 'real' program: sections to be able to control them under
  66. ; supervisor.
  67.  
  68. [program:test123]
  69. command=/usr/bin/python /home/wangzhe/test1.py ; the program (relative uses PATH, can take args)
  70. ;process_name=%(program_name)s ; process_name expr (default %(program_name)s)
  71. ;numprocs=1 ; number of processes copies to start (def 1)
  72. ;directory=/tmp ; directory to cwd to before exec (def no cwd)
  73. ;umask=022 ; umask for process (default None)
  74. ;priority=999 ; the relative start priority (default 999)
  75. ;autostart=true ; start at supervisord start (default: true)
  76. ;startsecs=1 ; # of secs prog must stay up to be running (def. 1)
  77. ;startretries=3 ; max # of serial start failures when starting (default 3)
  78. ;autorestart=unexpected ; when to restart if exited after running (def: unexpected)
  79. ;exitcodes=0,2 ; 'expected' exit codes used with autorestart (default 0,2)
  80. ;stopsignal=QUIT ; signal used to kill process (default TERM)
  81. ;stopwaitsecs=10 ; max num secs to wait b4 SIGKILL (default 10)
  82. ;stopasgroup=false ; send stop signal to the UNIX process group (default false)
  83. ;killasgroup=false ; SIGKILL the UNIX process group (def false)
  84. ;user=chrism ; setuid to this UNIX account to run the program
  85. ;redirect_stderr=true ; redirect proc stderr to stdout (default false)
  86. ;stdout_logfile=/a/path ; stdout log path, NONE for none; default AUTO
  87. ;stdout_logfile_maxbytes=1MB ; max # logfile bytes b4 rotation (default 50MB)
  88. ;stdout_logfile_backups=10 ; # of stdout logfile backups (0 means none, default 10)
  89. ;stdout_capture_maxbytes=1MB ; number of bytes in 'capturemode' (default 0)
  90. ;stdout_events_enabled=false ; emit events on stdout writes (default false)
  91. ;stderr_logfile=/a/path ; stderr log path, NONE for none; default AUTO
  92. ;stderr_logfile_maxbytes=1MB ; max # logfile bytes b4 rotation (default 50MB)
  93. ;stderr_logfile_backups=10 ; # of stderr logfile backups (0 means none, default 10)
  94. ;stderr_capture_maxbytes=1MB ; number of bytes in 'capturemode' (default 0)
  95. ;stderr_events_enabled=false ; emit events on stderr writes (default false)
  96. ;environment=A="1",B="2" ; process environment additions (def no adds)
  97. ;serverurl=AUTO ; override serverurl computation (childutils)
  98.  
  99. ; The sample eventlistener section below shows all possible eventlistener
  100. ; subsection values. Create one or more 'real' eventlistener: sections to be
  101. ; able to handle event notifications sent by supervisord.
  102.  
  103. ;[eventlistener:theeventlistenername]
  104. ;command=/bin/eventlistener ; the program (relative uses PATH, can take args)
  105. ;process_name=%(program_name)s ; process_name expr (default %(program_name)s)
  106. ;numprocs=1 ; number of processes copies to start (def 1)
  107. ;events=EVENT ; event notif. types to subscribe to (req'd)
  108. ;buffer_size=10 ; event buffer queue size (default 10)
  109. ;directory=/tmp ; directory to cwd to before exec (def no cwd)
  110. ;umask=022 ; umask for process (default None)
  111. ;priority=-1 ; the relative start priority (default -1)
  112. ;autostart=true ; start at supervisord start (default: true)
  113. ;startsecs=1 ; # of secs prog must stay up to be running (def. 1)
  114. ;startretries=3 ; max # of serial start failures when starting (default 3)
  115. ;autorestart=unexpected ; autorestart if exited after running (def: unexpected)
  116. ;exitcodes=0,2 ; 'expected' exit codes used with autorestart (default 0,2)
  117. ;stopsignal=QUIT ; signal used to kill process (default TERM)
  118. ;stopwaitsecs=10 ; max num secs to wait b4 SIGKILL (default 10)
  119. ;stopasgroup=false ; send stop signal to the UNIX process group (default false)
  120. ;killasgroup=false ; SIGKILL the UNIX process group (def false)
  121. ;user=chrism ; setuid to this UNIX account to run the program
  122. ;redirect_stderr=false ; redirect_stderr=true is not allowed for eventlisteners
  123. ;stdout_logfile=/a/path ; stdout log path, NONE for none; default AUTO
  124. ;stdout_logfile_maxbytes=1MB ; max # logfile bytes b4 rotation (default 50MB)
  125. ;stdout_logfile_backups=10 ; # of stdout logfile backups (0 means none, default 10)
  126. ;stdout_events_enabled=false ; emit events on stdout writes (default false)
  127. ;stderr_logfile=/a/path ; stderr log path, NONE for none; default AUTO
  128. ;stderr_logfile_maxbytes=1MB ; max # logfile bytes b4 rotation (default 50MB)
  129. ;stderr_logfile_backups=10 ; # of stderr logfile backups (0 means none, default 10)
  130. ;stderr_events_enabled=false ; emit events on stderr writes (default false)
  131. ;environment=A="1",B="2" ; process environment additions
  132. ;serverurl=AUTO ; override serverurl computation (childutils)
  133.  
  134. ; The sample group section below shows all possible group values. Create one
  135. ; or more 'real' group: sections to create "heterogeneous" process groups.
  136.  
  137. ;[group:thegroupname]
  138. ;programs=progname1,progname2 ; each refers to 'x' in [program:x] definitions
  139. ;priority=999 ; the relative start priority (default 999)
  140.  
  141. ; The [include] section can just contain the "files" setting. This
  142. ; setting can list multiple files (separated by whitespace or
  143. ; newlines). It can also contain wildcards. The filenames are
  144. ; interpreted as relative to this file. Included files *cannot*
  145. ; include files themselves.
  146.  
  147. ;[include]
  148. ;files = relative/directory/*.ini

转载于:https://my.oschina.net/hblt147/blog/3038643

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值