标签:ann new 日志文件 监听 app conf cin nes out
1:easy_install 安装: easy_install supervisor 2:pip 安装: pip install supervisor 3:Debian / Ubuntu可以直接通过apt安装: apt-get install supervisor
3.配置文件
安装完supervisor后,输入以下命令可得到配置文件:
配置文件如下(分号;表示注释):
; 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
以上配置文件用到几个部分:
示例如下,在目录/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:
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] 关闭所有/指定的程序进程
标签:ann new 日志文件 监听 app conf cin nes out
原文地址:https://www.cnblogs.com/yangmingxianshen/p/9639846.html