linux 使用进程管理工具 supervisor
1.supervisor是使用python进行开发的运行在linux服务器上的进程管理工具
老版本的supervisor需要运行在python2环境,如果需要使用supervisor管理python3的项目,需要借助于虚拟环境
事实上现在已经支持Python3了 https://github.com/Supervisor/supervisor 2.安装supervisor:
pip install supervisor python3环境安装:
pip3 install git+https://github.com/Supervisor/supervisor
3.生成配置文件:echo_supervisord_conf > /etc/supervisord.conf, 当进行到这一步时,终端提示需要
apt install supervisor,如果有该提示,执行命令进行安装即可,如果没有提示则忽略 4.编辑配置文件:vim /etc/supervisord.conf 1)修改最后两行,去掉前面的分号。
[include]
files = /etc/supervisord/*.conf files:管理进程的配置文件的路径,每一个进程都需要单独配置一个配置文件,这里需要根据实际情况配置 2)开启web控制台:找到如下几行,去掉注释 [inet_http_server] ; inet (TCP) server disabled by default
port=0.0.0.0:9001 ; ip_address:port specifier, *:port for all iface
username=admin ; default is no username (open server)
password=123456 ; default is no password (open server) 配置了这些参数以后就可以使用相应的用户名称和密码通过访问指定的ip和端口,从而通过web界面,管理进程,查看日志等 5.添加管理进程的目录
mkdir -p /etc/supervisord/
这里的目录需要和配置文件 supervisord.conf 里的 files 参数保持一致 6.新添加一个test1进程,进行管理
vim /etc/supervisord/test1.conf
路径需要和配置文件 supervisord.conf 里的 files 参数保持一致 [program:test1]
user=root
directory=/usr/local/test/
command=/usr/bin/python /usr/local/test/test.py
autostart=true
autorestart=true
loglevel=debug
log_stderr=true
stdout_logfile=/var/log/test1.log
redirect_stderr=true 说明:
1)每个进程的配置文件都必须拥有一个唯一的program名称
2)command 就是需要在终端进行输出的命令,通过命令启动进程
3)当有多个进程时,就需要定义多个进程管理配置文件 6.启动supervisor supervisord -c /etc/supervisord.conf 当启动supervisor管理工具时,也会同时启动所有添加到了管理中进程 7.查看添加到管理中的进程的状态
supervisorctl status 可以查看到每一个进程名称(program名称)所对应的状态 8.根据进程名称关闭,启动,重启进程
supervisorctl stop test1
supervisorctl start test1
supervisorctl restart test1 9.关闭supervisor
ps -ef | grep super 然后 kill -9 进程号 杀死进程 注意:
直接杀掉supervisor的主进程,被管理的进程仍然运行状态,所以记得先stop被管理的进程。
如果修改了任意一个配置文件,都需要重启supervisor。
linux 使用进程管理工具 supervisor的更多相关文章
- Linux之进程管理工具supervisor
环境:CentOS 7官方文档:http://supervisord.org/ 安装 # yum install -y epel-release # yum install -y supervisor ...
- Linux进程管理工具Supervisor的安装配置
目录 Linux进程管理工具Supervisor的安装配置 简介 安装Python包管理工具 安装Supervisor 配置 配置文件参数说明 配置进程管理 启动supervisor 控制进程 交互终 ...
- 进程管理工具supervisor
1. 简介 supervisor有两个组件:supervisord和supervisorctl,组成了client/server结构. supervisord负责读入配置文件,然后supervisor ...
- Supervisor安装与配置(Linux/Unix进程管理工具)
原文链接:http://blog.csdn.net/xyang81/article/details/51555473 Supervisor(http://supervisord.org/)是用Pyth ...
- Supervisor(Linux/Unix进程管理工具)安装与配置
参考链接:https://blog.csdn.net/xyang81/article/details/51555473 Supervisor(http://supervisord.org/)是用Pyt ...
- Linux进程管理工具——supervisor
介绍 Supervisord是用Python实现的一款非常实用的进程管理工具 安装 这里用源码 supervisor-.tar.gz .tar.gz cd supervisor- sudo pytho ...
- Python 进程管理工具 Supervisor 使用教程
Supervisor 是基于 Python 的进程管理工具,只能运行在 Unix-Like 的系统上,也就是无法运行在 Windows 上.Supervisor 官方版目前只能运行在 Python 2 ...
- 2017.7.21 linux下进程管理工具supervisord的安装与使用
参考来自:http://blog.haohtml.com/archives/15145 0 操作环境 1 supervisord的介绍 Supervisord是用Python实现的一款非常实用的进程管 ...
- 进程管理工具Supervisor(一)简介与使用
Supervisor是用Python开发的一套client/server架构的进程管理程序,能做到开机启动,以daemon进程的方式运行程序,并可以监控进程状态等等. linux进程管理方式有传统的r ...
随机推荐
- 求先序排列(NOIP2001&NOIP水题测试(2017082301))
题目链接:求先序排列 这道题讲白了,就是数的构造,然后遍历. 思路大致是这样: 我们先通过后序遍历,找到当前区间的根,然后在中序遍历中找到根对应的下标,然后就可以分出左右子树,建立当前根与左右子树根的 ...
- HYSBZ - 3676
模板题.问你一个串里最大的值(回文子串*出现次数) /* gyt Live up to every day */ #include<cstdio> #include<cmath> ...
- shell入门练习
**定义局部变量, 局部变量在退出Shell客户端时会失效** **单引号:原样输出** **双引号:如果里面有变量,会输出变量** **没有引号:输出变量** 可以在调用脚本的时候给脚本传递参数,脚 ...
- linux命令tee用法
功能说明:读取标准输入的数据,并将其内容输出成文件. 语 法:tee [-ai][--help][--version][文件…] 补充说明:tee指令会从标准输入设备读取数据,将其内容输出到标准输出设 ...
- idea创建maven项目报错,Error initializing: org.codehaus.plexus.velocity.DefaultVelocityComponent@56da52a7 java.lang.NoClassDefFoundError: org/apache/commons/lang/StringUtils
学着使用idea,想创建个maven项目,但是出师不利,立马报错,贼尴尬,错误信息如下: D:\Develop\JDK\bin\java.exe -Dmaven.multiModuleProjectD ...
- SpringBoot2.0.2 不使用parent作为maven单继承方式操作 : org.springframework.boot : spring-boot-dependencies : 2.0.2.RELEASE
1.pom配置方式 <?xml version="1.0" encoding="UTF-8"?> <project xmlns="h ...
- java并发里的一些基础概念
转载自:https://my.oschina.net/hosee/blog/597934: 摘要: 本系列基于炼数成金课程,为了更好的学习,做了系列的记录. 本文主要介绍 1.高并发的概念,为以后系列 ...
- VB连接MYSQL数据的方法
原文链接:http://hanbaohong.iteye.com/blog/704800 第一步:上网http://dev.mysql.com/downloads/connector/odbc/下载m ...
- Establish a website in 5 minutes
$sudo apt-get update //update $sudo apt-get install tasksel ...
- POJ1446 Girls and Boys
Girls and Boys Time Limit: 5000MS Memory Limit: 10000K Total Submissions: 12747 Accepted: 5678 D ...