手机版
你好,游客 登录 注册
背景:
阅读新闻

类Unix 操作系统进程监控控制工具 Supervisor

[日期:2016-04-13] 来源:Linux社区  作者:Linux [字体: ]

Supervisor 是一个客户端服务器系统,允许用户监控和控制类 Unix 操作系统上的进程数。

官网 http://supervisord.org

安装
1. easy_install supervisor
2.
setuptools (latest) from http://pypi.Python.org/pypi/setuptools.
meld3 (latest) from http://www.plope.com/software/meld3/.
elementtree (latest) from http://effbot.org/downloads#elementtree.

建立配置文件
echo_supervisord_conf > /etc/supervisord.conf
指定配置文件
supervisord -c supervisord.conf

查找配置文件路经
-c 指定配置文件
无指定配置文件时,查找顺序:
1 $CWD/supervisord.conf
2 $CWD/etc/supervisord.conf
3 /etc/supervisord.conf

配置文件说明

HTTP/XML-RPC 相关配置
[unix_http_server]
file = /tmp/supervisor.sock
chmod = 0777
chown= nobody:nogroup
username = user
password = 123

Web管理界面配置
[inet_http_server]
port = 127.0.0.1:9001
username = user
password = 123

[supervisorctl]
serverurl = unix:///tmp/supervisor.sock 和[unix_http_server]匹配
username = chris
password = 123
prompt = mysupervisor

日志 环境等配置
[supervisord]
logfile = /tmp/supervisord.log
logfile_maxbytes = 50MB
logfile_backups=10
loglevel = info
pidfile = /tmp/supervisord.pid
nodaemon = false
minfds = 1024
minprocs = 200
umask = 022
user = chrism
identifier = supervisor
directory = /tmp
nocleanup = true
childlogdir = /tmp
strip_ansi = false
environment = KEY1="value1",KEY2="value2"

配置单个进程
[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)
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 ; '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)
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 (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" ; process environment additions (def no adds)
serverurl=AUTO ; override serverurl computation (childutils)

另外配置还有
[fcgi-program:x]

[eventlistener:x]

[rpcinterface:x]

包含指定的配置文件
[include]
files = /an/absolute/filename.conf /an/absolute/*.conf foo.conf config??.conf

本文永久更新链接地址http://www.linuxidc.com/Linux/2016-04/130162.htm

linux
相关资讯       supervisor 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款