ICode9

精准搜索请尝试: 精确搜索
首页 > 系统相关> 文章详细

Ubuntu 安装和使用 Supervisor(进程管理)

2022-01-06 17:02:11  阅读:234  来源: 互联网

标签:supervisor supervisord supervisorctl conf Ubuntu 进程 Supervisor 安装 log


原文:Ubuntu 安装和使用 Supervisor(进程管理) - 田园里的蟋蟀 - 博客园 (cnblogs.com)

服务器版本 Ubuntu 16.04 LTS。

Supervisor 是一个用 Python 写的进程管理工具,可以很方便的对进程进行启动、停止、重启等操作。

安装命令:

$ apt-get install supervisor

安装成功后,会在/etc/supervisor目录下,生成supervisord.conf配置文件。

你也可以使用echo_supervisord_conf > supervisord.conf命令,生成默认的配置文件(不建议,内容比较多)。

supervisord.conf示例配置:

; supervisor config file

[unix_http_server]
file=/var/run/supervisor.sock   ; (the path to the socket file)
chmod=0700                       ; sockef file mode (default 0700)

[supervisord]
logfile=/var/log/supervisor/supervisord.log ; (main log file;default $CWD/supervisord.log)
pidfile=/var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
childlogdir=/var/log/supervisor            ; ('AUTO' child log dir, default $TEMP)

; the below section must remain in the config file for RPC
; (supervisorctl/web interface) to work, additional interfaces may be
; added by defining them in separate rpcinterface: sections
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface

[supervisorctl]
serverurl=unix:///var/run/supervisor.sock ; use a unix:// URL  for a unix socket

; The [include] section can just contain the "files" setting.  This
; setting can list multiple files (separated by whitespace or
; newlines).  It can also contain wildcards.  The filenames are
; interpreted as relative to this file.  Included files *cannot*
; include files themselves.

[include]
files = /etc/supervisor/conf.d/*.conf

进程配置会读取/etc/supervisor/conf.d目录下的*.conf配置文件,我们在此目录下创建一个hwapp.conf进程配置文件:

[program:hwapp]
directory=/root/wwwroot/hwapp/publish
command=dotnet hwapp.dll
autostart=true
autorestart=true
startretries=10
redirect_stderr=true
stdout_logfile=/root/wwwroot/hwapp/hwapp.log
environment=ASPNETCORE_ENVIRONMENT="Development"

需要注意的是,如果不是root账号,需要对这些目录进行权限设置,要不然会报一些错误(一定要在 root 账号下进行配置,要不然一系列权限引起的问题

标签:supervisor,supervisord,supervisorctl,conf,Ubuntu,进程,Supervisor,安装,log
来源: https://www.cnblogs.com/zhang1f/p/15771872.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有