supervisor 后台启动服务

supervisor

Centos 7 版本安装

安装

# 添加epel源
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
yum clean all
yum makecache

# 安装
yum install supervisor -y

配置

# 默认配置文件
/etc/supervisord.conf
# 打开后看最后行,指定自己要启动服务的配置文件路径
[include]
files = supervisord.d/*.ini

添加自己的服务

# cat dotnet.ini

[program:dotnet]
command=/data/dotnet/dotnet ApiDoc.Server.dll 
directory=/usr/swagger
autorestart=true
stderr_logfile=/usr/swagger/DotNetCoreWeb.err.log
stdout_logfile=/usr/swagger/DotNetCoreWeb.out.log 
environment=ASPNETCORE_ENVIRONMENT=Production 
user=root
stopsignal=INT
startsecs=1

参数解释:
program 服务名
command 调用的服务要写绝对路径。

报错处理:

can’t find command ‘dotnet’
command 里面写绝对路径即可。

猜你喜欢

转载自blog.csdn.net/lswzw/article/details/105006375