标签:supervisord linux 开启 关闭 开机自启动服务
centos7安装supervisord
#yum -y install supervisor
安装路径/usr/bin/supervisord,配置文件/etc/supervisor.conf
一、手动启动/关闭
supervisor手动启动:
#/usr/bin/supervisord -c /etc/supervisor.conf
supervisor手动关闭:
#/usr/bin/supervisorctl stop all 先关闭supervisor启动脚本,之后再关闭supervisord服务
#kill pid
supervisord开机自启动脚本(各版本系统):https://github.com/Supervisor/initscripts
二、添加开机自启动服务:
centos7 开机自启动脚本:
#vim /lib/systemd/system/supervisord.service
# supervisord service for sysstemd (CentOS 7.0+)
# by ET-CS (https://github.com/ET-CS)
[Unit]
Description=Supervisor daemon
[Service]
ExecStart=/usr/bin/supervisord
ExecStop=/usr/bin/supervisorctl $OPTIONS shutdown
ExecReload=/usr/bin/supervisorctl $OPTIONS reload
KillMode=process
Restart=on-failure
RestartSec=42s
[Install]
WantedBy=multi-user.target
这个自启动脚本需要修改/etc/supervisord.conf配置文件:
#vim /etc/supervisrod.conf
nodaemon=false 改成true
或者:#vim /lib/systemd/system/supervisord.service
[Unit]
Description=Process Monitoring and Control Daemon
After=rc-local.service
[Service]
Type=forking
ExecStart=/usr/bin/supervisord -c /etc/supervisord.conf
SysVStartPriority=99
[Install]
WantedBy=multi-user.target
无需修改/etc/supervisord.conf配置文件
两个自启动脚本都能够添加到systemctl自启动服务
#systemctl enable supervisord.service
#systemctl start/restart/stop supervisor.service
标签:supervisord linux 开启 关闭 开机自启动服务
原文地址:http://jasonzhu.blog.51cto.com/5594807/1699581