Supervisor是一个进程监控程序。

满足的需求是:我现在有一个进程需要每时每刻不断的跑,但是这个进程又有可能由于各种原因有可能中断。当进程中断的时候我希望能自动重新启动它,此时,我就需要使用到了Supervisor.

先弄懂两个命令:

supervisord : supervisor的服务器端部分,启动supervisor就是运行这个命令

supervisorctl:启动supervisor的命令行窗口

安装(Centos):

[root@iZ94xdyrdjmZ etc]# yum install python-setuptools

[root@iZ94xdyrdjmZ etc]# easy_install supervisor

测试是否安装成功

[root@iZ94xdyrdjmZ etc]# echo_supervisord_conf

会显示以下内容,其实是一个配置模版:

创建配置文件

[root@iZ94xdyrdjmZ etc]# echo_supervisord_conf > /etc/supervisord.conf

修改配置文件

在supervisord.conf最后增加(分号后边的表示注释,可以不写):

[include] 
files = /etc/subversion/*.ini

在 /etc/subversion/ 目录下建立 swoole-crontab.ini 文件

[program:swoole-crontab]
command=php /alidata/www/didi365/Crontab/main.php -d -s start
autorstart=true
autorestart=true
stdout_logfile=/tmp/supervisor.log

[Web配置]
[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))
如果配置了用户名和密码,就需要输入用户名和密码才能进入web界面

[启动supervisord]

[root@iZ94xdyrdjmZ etc]# supervisord

可能会输出一堆信息出来
/usr/lib/python2.6/site-packages/supervisor-3.1.3-py2.6.egg/supervisor/options.py:296: UserWarning: Supervisord is running as root and it is searching for its configuration file in default locations (including its current working directory); you probably want to specify a "-c" argument specifying an absolute path to a configuration file for improved security.
'Supervisord is running as root and it is searching '
/usr/lib/python2.6/site-packages/supervisor-3.1.3-py2.6.egg/supervisor/options.py:383: DeprecationWarning: Parameters to load are deprecated. Call .resolve and .require separately.
return pkg_resources.EntryPoint.parse("x="+spec).load(False)
不用管它

[root@iZ94xdyrdjmZ etc]# ps -ef | grep supervis

root 450 9437 0 11:31 pts/0 00:00:00 grep supervis
root 18836 1 0 10:02 ? 00:00:01 /usr/bin/python /usr/bin/supervisord

[命令行管理工具]

[root@iZ94xdyrdjmZ etc]# supervisorctl status

swoole-crontab                   RUNNING   pid 29981, uptime 0:33:05

如果修改了 /etc/supervisord.conf ,需要执行 supervisorctl reload 来重新加载配置文件

Error: Another program is already listening on a port that one of our HTTP servers is configured to use. Shut this program down first before starting

解决方法:

find / -name supervisor.sock

unlink /name/supervisor.sock

Supervisor 安装与配置的更多相关文章

  1. supervisor安装和配置

    直接命令 easy_install supervisor 如果报错先安装 yum install python-setuptools,再上面一条命令: 安装成功后显示finished,我们再次进行py ...

  2. Supervisor安装与配置(Linux/Unix进程管理工具)

    原文链接:http://blog.csdn.net/xyang81/article/details/51555473 Supervisor(http://supervisord.org/)是用Pyth ...

  3. supervisor安装及其配置

    一.supervisor概述 supervisor是一个c/s系统,被用来在类Unix系统中监控进程状态.supervisor使用python开发. 服务端进程为supervisord,主要负责启动自 ...

  4. Supervisor安装与配置

    Supervisor(http://supervisord.org/)是用Python开发的一个client/server服务,是Linux/Unix系统下的一个进程管理工具,不支持Windows系统 ...

  5. CentOS7下Supervisor安装与配置

    Supervisor(http://supervisord.org/)是用Python开发的一个client/server服务,是Linux/Unix系统下的一个进程管理工具,不支持Windows系统 ...

  6. supervisor 安装、配置、常用命令

    前言 在 web 应用部署到线上后,需要保证应用一直处于运行状态,在遇到程序异常.报错等情况,导致 web 应用终止时,需要保证程序可以立刻重启,继续提供服务. 所以,就需要一个工具,时刻监控 web ...

  7. 【转】supervisor安装与配置

    1.安装 宿主机环境:(Centos7) 宿主机环境 #yum install python-setuptools yum install python-setuptools#easy_install ...

  8. Supervisor安装、配置、开启启动

    1.安装Python包管理工具(easy_install) wget --no-check-certificate https://bootstrap.pypa.io/ez_setup.py -O - ...

  9. supervisor安装、配置和运行

    supervisor是python写的进程管理工具,supervisor能够批量对进程执行启动,停止,重启等操作,有效提高了运维效率.注意supervisor只能管理前台进程,supervisor会自 ...

随机推荐

  1. C语言之socket获取网页源码

    写爬虫也许你用的是python,类似urlopen(url).read()即可获得普通的网页的源码,或者用的java的网络库加上流操作,或者其他高级语言.但你有没有想过使用C语言来实现呢?我曾经以为用 ...

  2. Tiny C Compiler(Tcc)

    catalog . Tcc introduction . Tcc安装配置 . Tcc Programing 1.  Tcc introduction TCC基本和GCC兼容 . 符合ANSI C(C8 ...

  3. iptables实现反向代理

    拓扑图 实现目标 公网用户通过Firewall服务器(iptables实现)访问内网http服务 配置 #iptables iptables -t nat -A PREROUTING -p tcp - ...

  4. CentOs安装Scrapy出现error: Setup script exited with error: command ‘gcc’ failed with exit status 1错误解决方案

    按照 http://www.1207.me/archives/209.html 的教程安装Scrapy出现了上述错误,但是本身机器已经有了gcc,所以应该是安装包的问题 百度又看到了同博客里的解决方案 ...

  5. 模拟退火解决TSP问题

    // monituihuo.cpp : 定义控制台应用程序的入口点. // #include "stdafx.h" #include <stdio.h> #includ ...

  6. hadoop2.6.4运行wordcount

    hadoop用户登录,启动服务: start-dfs.sh && start-yarn.sh 创建输入目录: hadoop df -mkdir /input 把测试文件导入/input ...

  7. vs------密钥

    HM6NR-QXX7C-DFW2Y-8B82K-WTYJV

  8. [转载]将别人的项目或JAVA文件导入到自己的Eclipse中时,常常会出现JAVA文件的中文注释变成乱码的情况,解决办法

    eclipse 代码中文注释乱码 求解决 将别人的项目或JAVA文件导入到自己的Eclipse中时,常常会出现JAVA文件的中文注释变成乱码的情况,主要原因就是别人的IDE编码格式和自己的Eclips ...

  9. 9月9日HTML上午表单元素2(框架、样式表)

    五.框架 1.frameset是双标签框架集,如果使用框架集,当前页面不能有body. frameset属性:①cols代表左右拆分.cols=“300,*”表示左边框架宽300,右边宽剩余的宽度.* ...

  10. BigInteger类

    当一个数字非常大时,则肯定无法使用基本类型接受,所以使用了BigInteger类. BigInteger类表示是大整数类,定义在java.math包中,如果在操作时一个整型数据已经超过了整数的最大类型 ...