安装supervisor:
apt-get install -y supervisor
启动supervisor:
systemctl start supervisor
设置开机自启动:
systemctl enable supervisor
编辑配置文件:
实例:
supervisor 配置文件
编辑配置文件:
vim /etc/supervisor/supervisord.conf
添加:(开启supervisor网页功能)
[inet_http_server]
port=0.0.0.0:9001
username=user
password=123
添加进程配置文件
cd /etc/supervisor/conf.d/
zookeeper为例:
vim zk.conf
---------------------------------------------------------
[program:zk]
command = /usr/zookeeper-3.4.10/bin/zkServer.sh start-foreground
environmen=JAVA_HOME="/usr/jdk1.8"
user = root
autostart = true
autorestart = true
startsecs = 5
redirect_stderr = true
stopasgroup = true
ikillasgroup = true
stdout_logfile_maxbytes = 50MB
stdout_logfile_backups = 10
stdout_logfile = /var/log/supervisor/zk.log