[root@localhost /]#supervisord -c /etc/supervisor/supervisord.confsupervisord -c /etc/supervisor/supervisord.conf
[root@localhost /]# ps -ef | grep WebApplication1
root 29878 29685 0 09:57 ? 00:00:00 dotnet WebApplication1.dll
root 29892 29363 0 09:57 pts/3 00:00:00 grep --color=auto WebApplication1
如果存在dotnet WebApplication1.dll 进程则代表运行成功,这时候在使用浏览器进行访问。
至此关于ASP.NET Core应用程序的守护即配置完成。
Supervisor守护进程常用操作
【启动supervisord】
确保配置无误后可以在每台主机上使用下面的命令启动supervisor的服务器端supervisord
supervisord
【停止supervisord】
supervisorctl shutdown
【重新加载配置文件】
supervisorctl reload
七 、配置Supervisor开机启动新建一个“supervisord.service”文件
[root@localhost /]# vi supervisord.service
# dservice for systemd (CentOS 7.0+)
# by ET-CS (https://github.com/ET-CS)
[Unit]
Description=Supervisor daemon
[Service]
Type=forking
ExecStart=/usr/bin/supervisord -c /etc/supervisor/supervisord.conf
ExecStop=/usr/bin/supervisorctl shutdown
ExecReload=/usr/bin/supervisorctl reload
KillMode=process
Restart=on-failure
RestartSec=42s
[Install]
WantedBy=multi-user.target
将文件拷贝至:“/usr/lib/systemd/system/supervisord.service”
[root@localhost /]# cp supervisord.service /usr/lib/systemd/system/
执行命令:systemctl enable supervisord
[root@localhost /]# systemctl enable supervisord
Created symlink from /etc/systemd/system/multi-user.target.wants/supervisord.service to /usr/lib/systemd/system/supervisord.service.
执行命令:systemctl is-enabled supervisord #来验证是否为开机启动
[root@localhost /]# systemctl is-enabled supervisord
重启系统看能否能成功访问
[root@localhost /]# reboot