简介
Supervisor is a client/server system that allows its users to monitor and control a number of processes on UNIX-like operating systems.
官网:http://supervisord.org
安装
yum install supervisor
配置
配置文件路径
/etc/supervisord.d/*.ini
配置文件示例
/etc/supervisord.d/mypro.ini
[program:mypro]
environment=JAVA_HOME="/usr/java/jdk1.8.0_202-amd64"
directory=/path/to/mypro
command=sh /path/to/mypro/start.sh
autostart=true
autorestart=true
user=root
numprocs=1
startretries=3
stopasgroup=true
killasgroup=true
startsecs=5
stderr_logfile=/path/to/mypro/stderr.log
stdout_logfile=/path/to/mypro/stdout.log
可配置环境变量、启动命令、启动用户、日志目录等
启动
systemctl start supervisord.service
systemctl enable supervisord.service
使用
supervisorctl status
supervisorctl start
supervisorctl stop
supervisorctl restart
supervisorctl update
supervisorctl reload