-
Notifications
You must be signed in to change notification settings - Fork 22
linux使用supervisor
L edited this page Apr 16, 2021
·
3 revisions
sudo apt install python-pip
pip install supervisor
补充: apt安装
apt install supervisor
apt安装的有问题,报错: 解决unix:///var/run/supervisor.sock no such file的方法
在/etc/supervisor目录下,有conf.d
文件夹和supervisord.conf
文件
supervisord.conf
中有
[include]
files = /etc/supervisor/conf.d/*.conf
所以只需要去conf.d
文件夹下面添加一个.conf
文件,配置需要守护的进程即可
添加一个DotNet5Website.conf
#冒号后面为应用名称
[program:DotNet5Website]
#应用启动命令,需要dotnet的完整路径
command=dotnet ../../../home/xxx/publish/DotNet5Website.dll
#启动的目录,否则应用会报找不到appsetting.json错误
directory=../../../home/xxx/publish/DotNet5Website.dll
#服务启动时自动启动,崩溃自动重启
autostart=true
autorestart=true
# .net core mvc应用启动参数,表明是生产环境
environment=ASPNETCORE_ENVIRONMENT=Production
user=root
# 日志输出路径
stdout_logfile=../home/xxx/publish/logs/smartops.log
stderr_logfile=../home/xxx/publish/logs/smartops.err.log
supervisorctl status //查看所有进程的状态
supervisorctl stop es //停止es
supervisorctl start es //启动es
supervisorctl restart //重启es
supervisorctl update //配置文件修改后使用该命令加载新的配置
supervisorctl reload //重新启动配置中的所有程序
在supervisord.conf
文件中
[inet_http_server] ; inet (TCP) server disabled by default
port=*:9001 ; (ip_address:port specifier, *:port for all iface)
username=user ; (default is no username (open server))
password=123 ; (default is no password (open server))
unix:///var/run/supervisor.sock no such file
touch /var/run/supervisor.sock