Supervisor is a client/server system that allows its users to control a number of processes on UNIX-like operating systems.
Supervisor has been tested and is known to run on Linux (Ubuntu), Mac OS X (10.4, 10.5, 10.6), and Solaris (10 for Intel) and FreeBSD 6.1. It will likely work fine on most UNIX systems.
Supervisor 不可以在任何版本的 Windows 上运行
Supervisor will not run at all under any version of Windows.
Supervisor 可以运行在 Python 2.4 或者更高的 Python版本,但是不可以在任何 Python 3 的版本上运行。
Supervisor is known to work with Python 2.4 or later but will not work under any version of Python 3.
pip install supervisor
pip 地址:https://pypi.python.org/pypi/supervisor
GitHub:https://github.com/Supervisor/supervisor
文档地址:http://supervisord.org/
生成配置文件 supervisord.conf:
echo_supervisord_conf > /etc/supervisord.conf
修改 /etc/supervisord.conf 中的 include 为自己的配置文件存放地址。
例如:
[include]
files = /etc/supervisor/*.conf
取自官方文档的 example
http://supervisord.org/configuration.html#program-x-section-example
[program:cat]
command=/bin/cat
process_name=%(program_name)s
numprocs=1
directory=/tmp
umask=022
priority=999
autostart=true
autorestart=unexpected
startsecs=10
startretries=3
exitcodes=0,2
stopsignal=TERM
stopwaitsecs=10
stopasgroup=false
killasgroup=false
user=chrism
redirect_stderr=false
stdout_logfile=/a/path
stdout_logfile_maxbytes=1MB
stdout_logfile_backups=10
stdout_capture_maxbytes=1MB
stdout_events_enabled=false
stderr_logfile=/a/path
stderr_logfile_maxbytes=1MB
stderr_logfile_backups=10
stderr_capture_maxbytes=1MB
stderr_events_enabled=false
environment=A="1",B="2"
serverurl=AUTO
[program:cat] program: 后面是进程名,后续管理的时候使用这个名字。
command=/bin/cat:这个是执行的命令。
可以直接用:
supervisord
也可以指定配置文件的地址启动
supervisord -c /etc/supervisord.conf
启动了 supervisord 之后就可以用 supervisorctl 来查看进程状态以及管理进程。
status 查看进程状态
start xxx 启动 xxx 进程
stop xxx 关闭 xxx 进程
Supervisor 官方网站: http://supervisord.org/
Supervisor GitHub:https://github.com/Supervisor/supervisor
Supervisor pip:https://pypi.python.org/pypi/supervisor
2024 - 快车库 - 我的知识库 重庆启连科技有限公司 渝ICP备16002641号-10
企客连连 表单助手 企服开发 榜单123