ubuntu系统 supervisord 守护进程配置 .net core 项目

  1. 执行命令:
cd /etc/supervisor/conf.d
nano zichan.conf
  1. 写入配置文件

[program:minibreakpad] //进程名称
directory = /opt/pro/bin/publish //程序的启动目录
command = /opt/pro/bin/xiangmu run //启动命令 autostart = true //在supervisord 启动的时候也自动启动
startsecs = 5 //启动5秒后没有退出就当做已经正常启动
autorestart = true //程序异常退出后自动重启
startretries = 5 //启动失败自动重试次数 5
user = root //用哪个用户启动
redirect_stderr = true //把 stderr 重定向到 stdout 默认 false,如果是false就不需要设置下面的log配置
stdout_logfile_maxbytes = 20MB //stdout 日志文件大小,默认50MB
stdout_logfile_backups = 20 //stdout 日志文件备份数
//stdout 日志文件,需要注意当指定目录不存在时无法正常启动,所以需要手动创建目录(supervisord 会自动创建日志文件)
stdout_logfile = /opt/pro/logs/pro.log

  1. 执行命令
supervisord  -c /etc/supervisor/supervisord.conf

如果报错请看我另一篇日志:Error: Another program is already listening on a port that one of our HTTP servers is configured to
4. 查看项目是否启动

supervisorctl

如果项目运行起来就会出现运行列表

你可能感兴趣的:(基本操作,ubuntu,linux)