一、Supervisor的安装
方式1
1、安装Python包管理工具(easy_install)
yum install python-setuptools
2、安装Supervisor
easy_install supervisor
方式2
1、安装python的pip工具
yum install python-pip
2、安装Supervisor
pip install supervisor
二、配置supervisor
# echo_supervisord_conf > /etc/supervisord.conf
#vim /etc/supervisord.conf 修改最后两行即可
[include]
files = /etc/supervisord/*.conf
#mkdir /etc/supervisord/
三、启动服务
# supervisord -c /etc/supervisord.conf
四、配置java jar启动的子配置文件
#cat /etc/supervisord/wanyan.conf
[program:wanyan]
command = /soft/jdk1.8.0_191/bin/java -Xms256m -Xmx512m -jar -Dspring.profiles.active=test xm-extend-api-0.0.1-SNAPSHOT.jar
directory = /opt/wanyanzhenjiang/
process_name = %(program_name)s_%(process_num)s
numprocs = 1
autorestart = true
startsecs = 1
stdout_logfile_maxbytes = 50MB
stdout_logfile_backups = 20
stdout_logfile = /var/log/wanyan.log
stderr_logfile = /var/log/wanyan_err.log
加载配置文件
#supervisorctl #回车
#supervisor>reread #加载配置文件
#supervisor>update #启动服务
或者
#supervisorctl restart wanyan:*
也是可以的