11、CentOS8开机启动Supervisor服务

1. 创建supervisor.service文件

进入/lib/systemd/system目录,并创建supervisor.service文件,该文件内容如下所示。

# 先查看程序的路径

$whereis supervisord

supervisord: /usr/local/bin/supervisord /usr/local/bin/supervisord.conf

$whereis supervisorctl

supervisorctl: /usr/local/bin/supervisorctl

$cd /lib/systemd/system

$sudovim supervisor.service

2、配置文件内容如下:

[Unit]

Description=supervisor

After=network.target

[Service]

Type=forking

ExecStart=/usr/local/bin/supervisord -c /home/dotnba/supervisor/supervisord.conf

ExecStop=/usr/local/bin/supervisorctl $OPTIONS shutdown

ExecReload=/usr/local/bin/supervisorctl $OPTIONS reload

KillMode=process

Restart=on-failure

RestartSec=42s

[Install]

WantedBy=multi-user.target

3. 设置开机启动

$ systemctl enable supervisor.service

Created symlink /etc/systemd/system/multi-user.target.wants/supervisor.service → /usr/lib/systemd/system/supervisor.service

4.修改文件权限为766

$sudo chmod 766 supervisor.service


5.重启,验证是否生效

$shutdown -r now


参考文章1:CentOS8下安装Supervisior并为ASP.NET Core站点配置监控

参考文章2:CentOS8.2安装Supervisor并配置自启动

你可能感兴趣的:(11、CentOS8开机启动Supervisor服务)