Linux系列软件源码安装之三-----Supervisor
来源:互联网 发布:腾讯微信域名检测 编辑:程序博客网 时间:2024/05/19 11:49
Linux系列软件源码安装之三-----Supervisor
当前都是基于Centos 系统进行安装的,如果有其他Linux 系统,可能安装的命令会有变动,请参照相应的安装命令进行安装。
运行命令:
supervisorctl
来检测系统中是否安装了supervisor软件。如果没有安装请继续浏览以下安装步骤:
Supervisor是一个进程管理工具,用途就是有一个进程需要每时每刻不断的跑,但是这个进程又有可能由于各种原因有可能中断。当进程中断的时候我希望能自动重新启动它,此时,我就需要使用到了Supervisor
这个工具主要就两个命令:
supervisord : supervisor的服务器端部分,启动supervisor就是运行这个命令
supervisorctl:启动supervisor的命令行窗口。
安装(Centos):
- # yum install python-setuptools
- # easy_install supervisor
- 如果easy_install不好使就从官方下载:
- 然后通过python安装:
- # tar zxf supervisor-3.1.3.tar.gz
- # cd supervisor
- # python setup.py install
成功安装后可以登陆python控制台输入import supervisor 查看是否能成功加载。
生成配置文件(supervisord.conf):
echo_supervisord_conf > /etc/supervisord.conf
修改配置文件:
在supervisord.conf最后增加(分号后边的表示注释,可以不写):
- [program:bandwidth]
- command=python26 /usr/local/bin/bandwidth.sh ;需要执行的命令wd)
- user =root ;(default is current user , required if root)
- autostart=true ;start at supervisord start (default: true)
- autorestart=true ;whether/when to restart (default: unexpected)
- startsecs=3 ;number of secs prog must stay running ( def . 1)
- stderr_logfile=/tmp/bandwidth_err.log ;redirect proc stderr to stdout (default false) 错误输出重定向
- stdout_logfile=/tmp/bandwidth.log ;stdout log path, NONE for none; default AUTO, log输出
- (更多配置说明请参考:http://supervisord.org/configuration.html)
运行命令:
supervisord -c /etc/supervisord.conf //启动supervisor
supervisorctl //打开命令行
- [root @iZ2365j7l5bZ bin]# supervisorctl status
- bandwidth RUNNING pid 2423 , uptime 0 : 06 : 35
- [root @iZ2365j7l5bZ bin]# supervisorctl help
- default commands (type help <topic>):
- =====================================
- add clear fg open quit remove restart start stop update
- avail exit maintail pid reload reread shutdown status tail version
ctl中: help //查看命令
ctl中: status //查看状态
以上表示安装完成了supervisor。下面笔者将拓展配置使用 supervisor 管理PHP的启动:
vi /etc/supervisor.conf
在文件的最后加上以下代码:
- [program:php]
- command=/usr/local/php54/bin/php-f/root/supervisor/test.php#被监控进程
- ;process_name=%(process_num)02d
- ;numprocs=5#启动几个进程
- autostart=true#随着supervisord的启动而启动
- autorestart=true#自动启动
- startsecs=1#程序重启时候停留在runing状态的秒数,默认为1秒
- startretries=10#启动失败时的最多重试次数
- redirect_stderr=true#重定向stderr到stdout
- stdout_logfile=/root/supervisor/test.log#stdout文件
编辑完成之后,需要重新加载配置文件。使用以下命令即可:
supervisorctl reload
OK,重启完成。
如果您对以上安装步骤有任何疑问,可以直接留言或者私信我,一起交流!您也可以自由转载,但是需要加上 本文的链接地址:
http://blog.csdn.net/u012369749/article/details/50436898 本文由夜之寐搜集整理。
- Linux系列软件源码安装之三-----Supervisor
- Linux系列软件源码安装之三-----Supervisor
- Linux系列软件源码安装之二-----Composer
- Linux系列软件源码安装之四-----redis
- Linux系列软件源码安装之五-----vsftpd服务器
- Linux系列软件源码安装之一-----Git
- linux学习之源码安装软件
- Linux安装supervisor
- supervisor linux sdk 安装
- linux源码安装软件
- Linux 下的软件安装 之 源码包安装
- Linux软件安装与管理之源码安装方式
- Linux软件安装之Yum及源码编译安装
- Linux-----Linux源码安装软件
- linux安装、配置、使用supervisor
- Linux 源码安装软件之 configure 参数解释
- Linux 源码安装软件之 configure 参数解释
- Linux软件管理之RPM、YUM、源码编译安装
- SpringCloud--服务消费者(rest+ribbon)
- 智能设备云端数据点定义教程
- 四层网络模型和七层网络模型
- 数据库中的命名规范
- Datatable加载LoadDataRow时用BeginLoadData和EndLoadData提高效率
- Linux系列软件源码安装之三-----Supervisor
- 学习日记之多线程
- Layout Element Content Size Fitter Aspect Ratio Fitter
- 解决Zend Guard Loader的配置失败问题
- MyBatis的传入参数parameterType类型
- ENet-caffe源码的windows迁移
- python爬虫淘宝图片+GUI+打包成exe
- hdoj 1465
- Python之“可变”的tuple