• Supervisor 安装及配置管理uwsgi进程


    Supervisor介绍

    Supervisor 允许其用户在UNIX类操作系统上控制多个进程。 块如下:

    方便

    需要为每个进程实例编写rc.d脚本通常是不方便的。 rc.d脚本是进程初始化/自动启动/管理的常用形式,但写入和维护可能会很痛苦。此外,rc.d脚本不能自动重新启动崩溃的进程,并且许多程序在崩溃时不会正常重新启动。Supervisord启动进程作为其子进程,并可以配置为在崩溃时自动重新启动它们。它也可以自动配置为在其自身的调用中启动进程。

    准确性

    在UNIX上的进程通常很难获得准确的上/下状态。Pidfiles经常说谎。Supervisord启动进程作为子进程,所以它总是知道它的子进程的真正的上/下状态,可以方便地查询这些数据

    进程组

    进程通常需要以组为单位启动和停止,有时甚至在“优先级顺序”中。人们常常难以解释这一点。Supervisor 允许您为进程分配优先级,并允许用户通过supervisorctl客户端发出命令,如“全部启动”和“重新启动所有”,以预分配的优先级顺序启动它们。此外,进程可以分组为“进程组”,一组逻辑关联进程可以作为一个单元停止并启动。

     

    特征

    简单

    Supervisor通过简单的INI风格的配置文件进行配置,易于学习。它提供了许多每个进程选项,使您的生活更容易,如重新启动失败的进程和自动日志轮换。

    集中

    进程可以单独或分组控制。您可以配置Supervisor以提供本地或远程命令行和Web界面

    高效

    Supervisor通过fork / exec启动其子进程,子进程不进行后台进程。

    扩展性强

    Supervisor有一个简单的事件通知协议,用任何语言编写的程序都可以用来管理它,还有一个用于控制的XML-RPC接口。它还使用可以由Python开发人员利用的扩展点构建。

    兼容

    supervisor除Windows之外。它在Linux,Mac OS X,Solaris和FreeBSD上进行了测试和支持。它完全用Python编写,因此安装不需要C编译器。

    稳定性

    Supervisor已经存在多年,并已在许多服务器上使用。


    Supervisor 组件

    supervisord

    supervisord服务端程序。它负责在自己的调用中启动子程序,响应客户端的命令,重新启动崩溃或退出的子进程,记录其子进程stdoutstderr 输出,以及生成和处理对应于子进程生命周期中的“事件”。

    配置文件。这通常位于/etc/supervisord.conf中。此配置文件是“Windows-INI”样式的配置文件。适当的文件系统权限来保护此文件非常重要,因为它可能包含未加密的用户名和密码。

    supervisorctl

    supervisor的命令行客户端名为 supervisorctl。它为supervisor提供的功能提供了一个类似shell的界面。supervisorctl,用户可以连接到不同的 supervisord,停止和启动的子进程,并获得运行的进程的列表supervisord。

    命令行客户端通过UNIX域套接字或Internet(TCP)套接字与服务器通信。服务器可以断言客户端的用户在允许他执行命令之前应该出现认证凭证。客户端进程通常使用与服务器相同的配置文件,但其中具有[supervisorctl]部分的任何配置文件都可以正常工作。

    Web Server

    Web Server 可以通过浏览器访问查看和控制进程状态,在置文件的[inet_http_server]块里配置,访问服务器URL(例如http:// localhost:9001 /)以通过Web界面查看和控制进程状态。

    XML-RPC接口

    服务于Web UI的相同的HTTP服务器提供了一个XML-RPC接口,可用于询问和控制supervisor及其运行的程序。请参阅XML-RPC API文档


    Supervisor安装

    安装Supervisor的方法有很多种 具体请到Supervisor 官网

    链接如下 http://supervisord.org/installing.html

    YUM安装Supervisor (centos6  测试过用yum安装有问题, 建议使用源码安装方法)

    咱们这次使用源码安装 Supervisor

    安装setuptools

    下载supervisor源码包 && 解压 && 安装 && 生成模板文件 && 启动


    接下来在分析下配置文件

    ; Sample supervisor config file.
    ;
    ; For more information on the config file, please see:
    ; http://supervisord.org/configuration.html
    ;
    ; Notes:
    ; - Shell expansion ("~" or "$HOME") is not supported. Environment
    ; variables can be expanded using this syntax: "%(ENV_HOME)s".
    ; - Quotes around values are not supported, except in the case of
    ; the environment= options as shown below.
    ; - Comments must have a leading space: "a=b ;comment" not "a=b;comment".
    ; - Command will be truncated if it looks like a config file comment, e.g.
    ; "command=bash -c 'foo ; bar'" will truncate to "command=bash -c 'foo ".

    [unix_http_server]
    file=/tmp/supervisor.sock ; socket 文件路径
    ;chmod=0700 ; socket 文件 模式 (默认 0700)
    ;chown=nobody:nogroup ; socket file uid:gid owner
    ;username=user ; 使用supervisorctl连接的用户
    ;password=123 ; 上条用户的密码

    ;[inet_http_server] ; Web Server和远程的supervisorctl 配置块(默认关闭)
    ;port=127.0.0.1:9001 ; 监听的地址和端口
    ;username=user ; 登录时用的用户
    ;password=123 ; 上条用户的密码

    [supervisord]
    logfile=/tmp/supervisord.log ; supervisord进程日志路径
    logfile_maxbytes=50MB ; supervisord进程日志的大小 当超过50M时,会生成一个新的日志( 0 表示不限制)
    logfile_backups=10 ; 日志文件保持的数量,启动supervisor时 会自动创建10个buckup文件,用于log rotate ( 0 表示不限制)
    loglevel=info ; 日志级别
    pidfile=/tmp/supervisord.pid ; supervisord的pid文件路径。
    nodaemon=false ; 如果是true,supervisord进程将在前台运行 默认为false(后台运行)
    minfds=1024 ; 这个是最少系统空闲的文件描述符,低于这个值supervisor将不会启动
    minprocs=200 ; 最小可用的进程描述符,低于这个值supervisor也将不会正常启动
    ;umask=022 ; 进程创建文件的掩码 (默认 022)
    ;user=chrism ; 该参数指定的用户也可以对supervisord进行管理
    ;identifier=supervisor ; supervisord的标识符
    ;directory=/tmp ; 当supervisord以守护进程运行的时候,启动supervisord进程之前,会先切换到这个目录
    ;nocleanup=true ; false的时候 supervisord进程启动的时候 会在把以前子进程产生的日志文件(路径为AUTO的情况下)清除掉(true不清除)
    ;childlogdir=/tmp ; 当子进程日志路径为AUTO的时候,子进程日志文件的存放路径 (默认 $TMP)
    ;environment=KEY="value" ; 这个是用来设置环境变量的,supervisord在linux中启动默认继承了linux的 环境变量,在这里可以设置supervisord进程特有的其他环境变量supervisord启动子进程时,子进程会拷贝父进程的内存空间内容。 所以设置的这些环境变量也会被子进程继承 (默认不设置)
    ;strip_ansi=false ; 这个选项如果设置为true,会清除子进程日志中的所有ANSI( , ) 序列

    [rpcinterface:supervisor] ; 这个选项是给XML_RPC用的,果想使用supervisord或者web server 必须要开启
    supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface


    [supervisorctl]
    serverurl=unix:///tmp/supervisor.sock ; supervisorctl本地连接supervisord,本地UNIX socket
    ;serverurl=http://127.0.0.1:9001 ; supervisorctl远程连接supervisord的时候,用到的地址和端口
    ;username=chris ; 连接登录的用户名
    ;password=123 ; 密码
    ;prompt=mysupervisor ; 输入用户名密码时候的提示符 默认:mysupervisor
    ;history_file=~/.sc_history ; 指定历史命令的文件


    ;[program:theprogramname] ; 案例 [program:给要管理进程起的一个名字]
    ;command=/bin/cat ; 要执行的进程 可带参数 $1 $2 $3 注意!! 执行的进程不能是守护进程 ! !
    ;process_name=%(program_name)s ; 进程名 下条numprocs参数为1,就不用管这个参数 默认值%(program_name)s也就是上面的那个program冒号后面的名字
    ;numprocs=1 ; 启动进程的数目。当不为1时,就是进程池的概念,默认为1
    ;directory=/tmp ; 进程运行前,会前切换到这个目录
    ;umask=022 ; 进程掩码 (default None)
    ;priority=999 ; 子进程启动关闭优先级,优先级低的,最先启动,关闭的时候最后关闭 (default 999)
    ;autostart=true ; 设置为true 子进程将在supervisord启动后被自动启动
    ;startsecs=1 ; 设置子进程启动多少秒之后,此时状态如果是running,则我们认为启动成功了
    ;startretries=3 ; 进程启动失败后,最大尝试启动的次数 当超过3次后,supervisor将把此进程的状态置为FAIL
    ;autorestart=unexpected ; 设置子进程挂掉后自动重启的情况,有三个选项,false,unexpected和true。如果为false的时候,无论什么情况下,都不会被重新启动,如果为unexpected,只有当进程的退出码不在上面的exitcodes里面定义的退出码的时候,>才会被自动重启。当为true的时候,只要子进程挂掉,将会被无条件的重启
    ;exitcodes=0,2 ; 注意和上面的的autorestart=unexpected对应 exitcodes里面的定义的退出码是expected的。
    ;stopsignal=QUIT ; 进程停止信号,可以为TERM, HUP, INT, QUIT, KILL, USR1, or USR2等信号 默认为TERM 当用设定的信号去杀掉进程,退出码会被认为是expected
    ;stopwaitsecs=10 ; 这个是当我们向子进程发送stopsignal信号后,到系统返回信息给supervisord,所等待的最大时间。 超过这个时间,supervisord会向该子进程发送一个强制kill的信号(默认10秒)
    ;stopasgroup=false ; 这个东西主要用于,supervisord管理的子进程,这个子进程本身还有子进程 那么我们如果仅仅干掉supervisord的子进程的话,子进程的子进程有可能会变成孤儿进程 所以咱们可以设置可个选项,把整个该子进程的整个进程组都干掉 设置为true的话,一般killasgroup也会被设置为true 该选项发送的是stop信号(def false)
    ;killasgroup=false ; 这个和上面的stopasgroup类似,不过发送的是kill信号(def false)
    ;user=chrism ; 如果supervisord是root启动,我们在这里设置这个非root用户,可以用来管理该program 默认不设置
    ;redirect_stderr=true ; 为true,则stderr的日志会被写入stdout日志文件中 (default false)
    ;stdout_logfile=/a/path ; 子进程的stdout的日志路径,可以指定路径,AUTO,none等三个选项 设置为none的话,将没有日志产生。设置为AUTO的话,将随机找一个地方成日志文件,而且当supervisord重新启动的时候,以前的日志文件会被清空。当 redirect_stderr=true的时候,sterr也会写进这个日志文件
    ;stdout_logfile_maxbytes=1MB ; 日志文件最大大小,和[supervisord]中定义的一样 (default 50MB)
    ;stdout_logfile_backups=10 ; 和[supervisord]定义的一样 (0 means none, default 10)
    ;stdout_capture_maxbytes=1MB ; 这个东西是设定capture管道的大小,当值不为0的时候,子进程可以从stdout发送信息,而supervisor可以根据信息,发送相应的event (default 0)
    ;stdout_events_enabled=false ; 为ture的时候,当子进程由stdout向文件描述符中写日志的时候,将触发supervisord发送PROCESS_LOG_STDOUT类型的event(default false)
    ;stderr_logfile=/a/path ; 设置stderr写的日志路径,当redirect_stderr=true。这个就不用设置了,设置了也是白搭。因为它会被写入stdout_logfile的同一个文件中 default AUTO(随便找个地存,supervisord重启被清空)
    ;stderr_logfile_maxbytes=1MB ; max # logfile bytes b4 rotation (default 50MB)
    ;stderr_logfile_backups=10 ; # of stderr logfile backups (0 means none, 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" ; 这个是该子进程的环境变量,和别的子进程是不共享的
    ;serverurl=AUTO ; override serverurl computation (childutils)


    ;[eventlistener:theeventlistenername] ;这个东西其实和program的地位是一样的,也是suopervisor启动的子进程,不过它干的活是订阅supervisord发送的event。他的名字就叫listener了。我们可以在listener里面做一系列处理,比如报警....
    ;command=/bin/eventlistener ; 和上面的program一样,表示listener的可执行文件的路径
    ;process_name=%(program_name)s ; 这个也一样,进程名,当下面的numprocs为多个的时候,才需要。否则默认就OK了
    ;numprocs=1 ; 相同的listener启动的个数
    ;events=EVENT ; event event事件的类型,也就是说,只有写在这个地方的事件类型。才会被发送
    ;buffer_size=10 ; event队列缓存大小 (default 10)
    ;directory=/tmp ; 进程执行前,会切换到这个目录下执行 (def no cwd)
    ;umask=022 ; umask for process (default None)
    ;priority=-1 ; 启动优先级 (default -1)
    ;autostart=true ; true supervisord启动一起启动 (default: true)
    ;startsecs=1 ; 设置子进程启动多少秒之后,此时状态如果是running,则我们认为启动成功了 (def. 1)
    ;startretries=3 ; 失败最大尝试次数 (default 3)
    ;autorestart=unexpected ; 和program一样 (def: unexpected)
    ;exitcodes=0,2 ; 'expected' exit codes used with autorestart (default 0,2)
    ;stopsignal=QUIT ; signal used to kill process (default TERM)
    ;stopwaitsecs=10 ; max num secs to wait b4 SIGKILL (default 10)
    ;stopasgroup=false ; send stop signal to the UNIX process group (default false)
    ;killasgroup=false ; SIGKILL the UNIX process group (def false)
    ;user=chrism ; setuid to this UNIX account to run the program
    ;redirect_stderr=false ; redirect_stderr=true is not allowed for eventlisteners
    ;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 (0 means none, 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=10 ; # of stderr logfile backups (0 means none, 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分组,划分到组里面的program。我们就不用一个一个去操作了 我们可以对组名进行统一的操作。 注意:program被划分到组里面之后,就相当于原来的配置从supervisor的配置文件里消失了supervisor只会对组进行管理,而不再会对组里面的单个program进行管理了
    ;programs=progname1,progname2 ; 组成员,用逗号分开
    ;priority=999 ; 优先级,相对于组和组之间 (default 999)


    ;[include] ; 跟Nginx虚拟主机一个样
    ;files = relative/directory/*.ini

    supervisor 命令

    bash终端

    supervisorctl status
    supervisorctl stop tomcat
    supervisorctl start tomcat
    supervisorctl restart tomcat
    supervisorctl reread
    supervisorctl update

    supervisor配置开机启动 centos7

    [root@dev system]# cd /usr/lib/systemd/system

    [root@dev system]# cat supervisor.service
    [Unit]
    Description=supervisor
    After=network.target

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

    [Install]
    WantedBy=multi-user.target

    [root@dev system]# systemctl enable supervisor
    [root@dev system]# systemctl is-enabled supervisor
    enabled

    实际配置文件:

    [root@dev supervisord.d]# cat /etc/supervisord.conf
    ; Sample supervisor config file.
    ;
    ; For more information on the config file, please see:
    ; http://supervisord.org/configuration.html
    ;
    ; Notes:
    ; - Shell expansion ("~" or "$HOME") is not supported. Environment
    ; variables can be expanded using this syntax: "%(ENV_HOME)s".
    ; - Quotes around values are not supported, except in the case of
    ; the environment= options as shown below.
    ; - Comments must have a leading space: "a=b ;comment" not "a=b;comment".
    ; - Command will be truncated if it looks like a config file comment, e.g.
    ; "command=bash -c 'foo ; bar'" will truncate to "command=bash -c 'foo ".

    [unix_http_server]
    file=/var/sockets/supervisor.sock ; the path to the socket file
    ;chmod=0700 ; socket file mode (default 0700)
    ;chown=nobody:nogroup ; socket file uid:gid owner
    ;username=user ; default is no username (open server)
    ;password=123 ; default is no password (open server)

    ;[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)

    [supervisord]
    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 ; # of main logfile backups; 0 means none, default 10
    loglevel=info ; 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
    ;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 rpcinterface:supervisor 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:x] sections.

    [rpcinterface:supervisor]
    supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface

    ; The supervisorctl section configures how supervisorctl will connect to
    ; supervisord. configure it match the settings in either the unix_http_server
    ; or inet_http_server section.

    [supervisorctl]
    serverurl=unix:///var/sockets/supervisor.sock ; use a unix:// URL for a unix socket
    ;serverurl=http://127.0.0.1:9001 ; use an http:// url to specify an inet socket
    ;username=chris ; should be same as in [*_http_server] if set
    ;password=123 ; should be same as in [*_http_server] if set
    ;prompt=mysupervisor ; cmd line prompt (default "supervisor")
    ;history_file=~/.sc_history ; use readline history if available

    ; The sample program section below 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 ; 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)
    ;directory=/tmp ; directory to cwd to before exec (def no cwd)
    ;umask=022 ; umask for process (default None)
    ;priority=999 ; the relative start priority (default 999)
    ;autostart=true ; start at supervisord start (default: true)
    ;startsecs=1 ; # of secs prog must stay up to be running (def. 1)
    ;startretries=3 ; max # of serial start failures when starting (default 3)
    ;autorestart=unexpected ; when to restart if exited after running (def: unexpected)
    ;exitcodes=0,2 ; 'expected' exit codes used with autorestart (default 0,2)
    ;stopsignal=QUIT ; signal used to kill process (default TERM)
    ;stopwaitsecs=10 ; max num secs to wait b4 SIGKILL (default 10)
    ;stopasgroup=false ; send stop signal to the UNIX process group (default false)
    ;killasgroup=false ; SIGKILL the UNIX process group (def 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 (0 means none, 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 (0 means none, 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" ; process environment additions (def no adds)
    ;serverurl=AUTO ; override serverurl computation (childutils)

    ; The sample eventlistener section below shows all possible eventlistener
    ; subsection values. Create one or more 'real' eventlistener: sections to be
    ; able to handle event notifications sent by supervisord.

    ;[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)
    ;startsecs=1 ; # of secs prog must stay up to be running (def. 1)
    ;startretries=3 ; max # of serial start failures when starting (default 3)
    ;autorestart=unexpected ; autorestart if exited after running (def: unexpected)
    ;exitcodes=0,2 ; 'expected' exit codes used with autorestart (default 0,2)
    ;stopsignal=QUIT ; signal used to kill process (default TERM)
    ;stopwaitsecs=10 ; max num secs to wait b4 SIGKILL (default 10)
    ;stopasgroup=false ; send stop signal to the UNIX process group (default false)
    ;killasgroup=false ; SIGKILL the UNIX process group (def false)
    ;user=chrism ; setuid to this UNIX account to run the program
    ;redirect_stderr=false ; redirect_stderr=true is not allowed for eventlisteners
    ;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 (0 means none, 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=10 ; # of stderr logfile backups (0 means none, 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 sample group section below shows all possible group values. Create one
    ; or more 'real' group: sections to create "heterogeneous" process groups.

    ;[group:thegroupname]
    ;programs=progname1,progname2 ; each refers to 'x' in [program:x] definitions
    ;priority=999 ; the relative start priority (default 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]
    files = /etc/supervisord.d/*.ini

    [root@dev supervisord.d]# cat activities.ini
    [program:activities]
    command =/data/init_start/activities.sh run
    autostart=true
    startsecs=5
    autorestart=true
    startretries=3
    user=nobody
    redirect_stderr = true
    stdout_logfile_maxbytes=20MB
    stdout_logfile_backups=20
    stdout_logfile=/data/logs/supervisor/supervisor_django.log
    stderr_logfile=/data/logs/supervisor/supervisor_error_django.log
    stopasgroup=true
    killasgroup=true
    stopsignal=QUIT
    [include]
    files = /etc/supervisord.d/activities.ini

    [root@dev supervisord.d]# cat /data/init_start/activities.sh
    #!/bin/bash

    env LANG=en_US.UTF-8
    env LANGUAGE=en_US:
    env LC_CTYPE=en_US.UTF-8


    cd /data/website/activities/source/

    ToDay=$(date '+%Y%m%d')
    source /data/website/activities/virtualenv/bin/activate & source /data/website/activities/source/conf/develop.ini
    /data/website/activities/virtualenv/bin/uwsgi -M -C -s /tmp/activities_service.sock --listen 10000 --wsgi-file /data/website/activities/source/base/wsgi.py --logto /data/logs/uwsgi/activities/access_${ToDay}.log --enable-threads --uid nobody --gid nobody

  • 相关阅读:
    if..endif 语法
    WordPress程序流程分析
    php锁表
    jQuery入门必须掌握的一些API
    集合栈
    回文链表
    链式A+B
    链表分割
    访问单个节点的删除
    链表中倒数第k个结点
  • 原文地址:https://www.cnblogs.com/weifeng1463/p/8351020.html
Copyright © 2020-2023  润新知