1、安装supervisor

yum install supervisor
执行完之后 在/etc 目录中会生成 supervisord.conf

/usr/bin/supervisord -c /etc/supervisord.conf如果报错

重新执行echo_supervisord_conf > /etc/supervisor/supervisord.conf如提示没有目录,创建后再执行到此文件中把配置文件路径再变改vim /usr/lib/systemd/system/supervisord.service

如重启失败,提示以下Warning: supervisord.service changed on disk. Run 'systemctl daemon-reload' to reload units.

然后再重启

开机自动启动 SupervisordSupervisord 默认情况下并没有被安装成服务,它本身也是一个进程。官方已经给出了脚本可以将 Supervisord 安装成服务,可以参考这里查看各种操作系统的安装脚本

centos7+上面可以使用 initscripts/centos-systemd-etcs 这个脚本

把这个文件重命名并放到 /usr/lib/systemd/system/supervisord.service 路径下。

然后执行一下命令,重新加载系统服务:

systemctl daemon-reload执行这个命令,启动服务:

systemctl start supervisord查看服务状态:

systemctl status supervisord可以看到服务以正常启动:

● supervisord.service - Supervisor daemonLoaded: loaded (/usr/lib/systemd/system/supervisord.service; disabled; vendor preset: disabled)Active: active (running) since Fri 2017-03-10 15:35:32 CST; 25min agoProcess: 4073 ExecStart=/usr/bin/supervisord -c /etc/supervisord.conf (code=exited, status=0/SUCCESS)Main PID: 4076 (supervisord)CGroup: /system.slice/supervisord.service└─4076 /usr/bin/python /usr/bin/supervisord -c /etc/supervisord.co...

Mar 10 15:35:32 iz2zefecs7fwoasgkebymoz systemd[1]: supervisord.service holdo...Mar 10 15:35:32 iz2zefecs7fwoasgkebymoz systemd[1]: Starting Supervisor daemo...Mar 10 15:35:32 iz2zefecs7fwoasgkebymoz systemd[1]: Started Supervisor daemon.Hint: Some lines were ellipsized, use -l to show in full.

04-22 16:37