从 https://github.com/Supervisor/initscripts 下载 initscript,注意根据当前机器 supervisor 的安装情况和 supervisor.conf 的配置情况调整 centos-systemd-etcs initscript,
# supervisord service for systemd (CentOS 7.0+, Ubuntu 16.04+) # by ET-CS (https://github.com/ET-CS) [Unit] Description=Supervisor daemon [Service] Type=forking ExecStart=/usr/local/bin/supervisord ExecStop=/usr/local/bin/supervisorctl $OPTIONS shutdown ExecReload=/usr/bin/supervisorctl $OPTIONS reload KillMode=process Restart=on-failure RestartSec=42s [Install] WantedBy=multi-user.target
将其拷贝到 /lib/systemd/system,并重命名为 supervisor.service
$ sudo cp centos-systemd-etcs /lib/systemd/system/supervisor.service
然后 enable 该服务,并启动,
$ sudo systemctl enable supervisor.service $ sudo systemctl start supervisor.service
然后 supervisor 就可以开机启动了。
(完)