supervisor 如何在 centos 7 启动时自动运行?
大家讲道理
大家讲道理 2017-04-25 09:04:08
0
3
794

supervisor 是用 yum install supervisor 进行安装的,安装后发现如果服务器重启,需要手动运行 supervisord 后才能执行 supervisor 管理的服务。

在官网 Running supervisord automatically on startup 这篇文章中描述,因为我不是用 "distribution-packaged" 安装的,所以不会被自动添加进去(用 easy_install supervisor 安装不成功)

同时还提供了第三方脚本,但是不知道怎么用 https://github.com/Supervisor/initscripts

请问,如何让 supervisor 在 centos 7 系统重启后自动运行呢?

大家讲道理
大家讲道理

光阴似箭催人老,日月如移越少年。

reply all(3)
某草草

centos 7 is managed with systemctl, just run the following code:

$ systemctl enable supervisord.service

# 运行结果
Created symlink from /etc/systemd/system/multi-user.target.wants/supervisord.service to /usr/lib/systemd/system/supervisord.service.

If it still cannot start, you can edit the supervisord.service file in the above path and replace it with the centos-systemd-etcs from github:

# supervisord service for sysstemd (CentOS 7.0+)
# by ET-CS (https://github.com/ET-CS)
[Unit]
Description=Supervisor daemon

[Service]
Type=forking
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
巴扎黑

CentOS7 is systemd. It should be enough to install the centos-systemd-etcs unit from that repo to /etc (check the specific path yourself).


But why isn’t yum the distribution-packaged version? Where did this rpm come from? rpm -ql supervisorWhat is the result?

仅有的幸福

yum installation has a deep pit, it is recommended to uninstall and replace the installation method

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!