【Centos7】 中使用Supervisor守护进程

原文出处:html

Centos7 中使用Supervisor守护进程

 

配置supervisor实现进程守护

1.安装supervisor

 yum install Supervisor 
 

2.启动服务

supervisord -c /etc/supervisord.conf

 进入 cd /etc 目录 找到supervisord.conf 配置文件 和 supervisord.d 文件夹,使用vim编辑supervisord.conf文件,拉到最底部咱们能够看到vim

 files = supervisord.d/*.ini 这句代码说明它会加载supervisord.d文件夹中的全部.ini配置文件

3.编辑配置文件

随后咱们在supervosprd.d中建立一个delploy.ini文件并编辑以下
复制代码
复制代码
[program:DeployLinux]   #DeployLinux  为程序的名称
command=dotnet DeployLinux.dll #须要执行的命令
directory=/home/publish #命令执行的目录
environment=ASPNETCORE__ENVIRONMENT=Production #环境变量
user=root #用户
stopsignal=INT 
autostart=true #是否自启动
autorestart=true #是否自动重启
startsecs=3 #自动重启时间间隔(s)
stderr_logfile=/var/log/ossoffical.err.log #错误日志文件
stdout_logfile=/var/log/ossoffical.out.log #输出日志文件
复制代码
复制代码

 4.重载配置文件

执行命令使用心得配置文件运行supervisor服务post

supervisorctl reload  //从新加载配置文件
相关文章
相关标签/搜索