安装supervisor方法,可以直接用 yum install supervisord ,但是版本可能会旧一点,可以参考官方的方法:

easy_install supervisor

http://supervisord.org/installing.html#installing-to-a-system-with-internet-access

加入service, vim /etc/init.d/supervisord , 修改文件属性为可执行chmod 777 /etc/init.d/supervisord

#!/bin/bash
#
# supervisord This scripts turns supervisord on
#
# Author: Mike McGrath <mmcgrath@redhat.com> (based off yumupdatesd)
# Jason Koppe <jkoppe@indeed.com> adjusted to read sysconfig,
# use supervisord tools to start/stop, conditionally wait
# for child processes to shutdown, and startup later
#
# chkconfig:
#
# description: supervisor is a process control utility. It has a web based
# xmlrpc interface as well as a few other nifty features.
# processname: supervisord
# config: /etc/supervisord.conf
# pidfile: /var/run/supervisord.pid
# # source function library
. /etc/rc.d/init.d/functions # source system settings
[ -e /etc/sysconfig/supervisord ] && . /etc/sysconfig/supervisord RETVAL= start() {
echo "Starting supervisord: "
if [ -e $PIDFILE ]; then
echo "ALREADY STARTED"
return
fi # start supervisord with options from sysconfig (stuff like -c)
/usr/bin/supervisord $OPTIONS # show initial startup status
/usr/bin/supervisorctl $OPTIONS status # only create the subsyslock if we created the PIDFILE
[ -e $PIDFILE ] && touch /var/lock/subsys/supervisord
} stop() {
echo -n "Stopping supervisord: "
/usr/bin/supervisorctl $OPTIONS shutdown
if [ -n "$WAIT_FOR_SUBPROCESSES" ]; then
echo "Waiting roughly 60 seconds for $PIDFILE to be removed after child processes exit"
for sleep in last; do
if [ ! -e $PIDFILE ] ; then
echo "Supervisord exited as expected in under $total_sleep seconds"
break
else
if [[ $sleep -eq "last" ]] ; then
echo "Supervisord still working on shutting down. We've waited roughly 60 seconds, we'll let it do its thing from here"
return
else
sleep $sleep
total_sleep=$(( $total_sleep + $sleep ))
fi fi
done
fi # always remove the subsys. we might have waited a while, but just remove it at this point.
rm -f /var/lock/subsys/supervisord
} restart() {
stop
start
} case "$1" in
start)
start
RETVAL=$?
;;
stop)
stop
RETVAL=$?
;;
restart|force-reload)
restart
RETVAL=$?
;;
reload)
/usr/bin/supervisorctl $OPTIONS reload
RETVAL=$?
;;
condrestart)
[ -f /var/lock/subsys/supervisord ] && restart
RETVAL=$?
;;
status)
/usr/bin/supervisorctl $OPTIONS status
RETVAL=$?
;;
*)
echo $"Usage: $0 {start|stop|status|restart|reload|force-reload|condrestart}"
exit
esac exit $RETVAL

配置一下,echo_supervisord_conf > /etc/supervisord.conf

加入gearman的任务,下面是百度云推送的任务

vim /etc/supervisord.conf

[program:APNS_PUSH]
command=/usr/bin/php /data2/www/web/apns/worker_origin.php
process_name=APNS_PUSH_%(process_num)s
numprocs=
autostart=true
autorestart=true
user=nginx
stdout_logfile=/data2/log/push/push_%(process_num)s.log
stderr_logfile=/data2/log/push/push.error.log

下面先启动gearman,启动supervisord,ps -ef |grep xxx 查看一下任务有没有执行

另外,也可以使用gearman-monitor来查看gearman任务状态

supervisor监控gearman任务的更多相关文章

  1. [erlang]supervisor(监控树)的重启策略

    1. init函数 init() -> {ok, {SupFlags, [ChildSpec,...]}} | ignore. [ChildSpec,...] 是在init之后默认要启动的子进程 ...

  2. 使用supervisor监控进程

    在linux下监控进程,可以使用inittab,最近找到了supervisor,也很好用,记录一下:1.系统要安装python,并安装与之对应的setuptools,下载地址在此2.安装:# sh s ...

  3. nodemon 或者 Supervisor 监控 Express4.x的代码改动

    Express 4.x 默认将启动模块分离到了./bin/www中,直接使用 supervisor/nodemon 无法正常监控应用,使得开发过程中的调试非常不方便.所以我们直接把./bin/www中 ...

  4. [Erlang13]怎么把一个普通的进程挂入Supervisor监控树?

    简单来说:应该是在调用的start_link返回一个{ok,Pid}就可以把这个进程放入监控树Supervisor里面: -module(worker). -author("zhongwen ...

  5. Python学习笔记【Supervisor】:使用Supervisor监控Tornado进程

    Linux常见应用服务配置模式nginx和supervisor:采用主配置文件+项目配置文件 安装(如果使用pip安装注意看是否需要指定使用python2版本) 第一步:在Linux中使用apt-ge ...

  6. supervisor 监控redis & mongodb

    安装 安装python brew install python 安装pipwget https://bootstrap.pypa.io/get-pip.pysudo python get-pip.py ...

  7. 分布式的任务分发框架-Gearman

    官方文档:http://gearman.org/getting-started/ 安装方法和示例都有,可以详细看一下. Gearman是一个分发任务的程序框架,可以用在各种场合,与Hadoop相比,G ...

  8. 【supervisor】监控服务

    写了一个ftp服务,用supervisor监控一下 1.先写一个配置文件,路径和名称为/etc/supervisord.conf.d/ftp-server.ini [program:ftp-serve ...

  9. 关于supervisor无法监控golang代码的解决方法

    之前一直都是使用如下方式运行go代码 # go run test.go 这种运行方式是直接编译运行go代码,虽然在调试的时候没出什么问题,但是在使用supervisor监控的时候,会提示如下错误:(b ...

随机推荐

  1. c# 框架学习(nop )总结-------删除功能

    删除直接使用(框架中以封装好的) 控制中写就可以啦 public ActionResult Delete(int id) { //权限位置(若需要的话)var individual = _indivi ...

  2. Linux上设置nginx支持https

    1.前提条件 如果系统没有自带openssl,则需要安装. 2.生成证书 # .首先,进入你想创建证书和私钥的目录,例如: cd /etc/nginx/ # .创建服务器私钥,命令会让你输入一个口令: ...

  3. WinForm动态添加控件及其事件(转)

    出处:http://blog.sina.com.cn/s/blog_60d576800100tf61.html 1        private void PhotoForm_Load(object  ...

  4. 【原】java环境变量配置&& jdk配置 && 各配置的意义

    本配置需要新建JAVA_HOME和classpath两个: JAVA_HOME 指明JDK安装路径.(在安装好java之后就该配置) classpath 为java加载类(class or lib)路 ...

  5. VMware12 安装 CentOS 6.5 64位

    前言:本人在配置Hadoop的过程中,需要搭建Cent OS 64 环境,借此,顺便将Cent OS 64 的安装在此记录,方便自己,也方便大家学习.本次是在VM12虚拟机中实现Cent OS 64 ...

  6. submit(提交)按钮

    为form添加一个submit(提交)按钮,点击这个按钮,表单中的数据将会被发送到通过action属性指定的地址上. 下面是submit按钮的例子: <button type="sub ...

  7. 开源IP代理池续——整体重构

    开源IP代理池 继上一篇开源项目IPProxys的使用之后,大家在github,我的公众号和博客上提出了很多建议.经过两周时间的努力,基本完成了开源IP代理池IPProxyPool的重构任务,业余时间 ...

  8. Could not create the view: An unexpected exception was thrown 异常处理

    MyEclipse 打开后有时候莫名的在server窗口里抛出"Could not create the view: An unexpected exception was thrown&q ...

  9. mysql 语句解释执行顺序

    (7) SELECT (8) DISTINCT <select_list> (1) FROM <left_table> (3) <join_type> JOIN & ...

  10. Frugalware Linux 1.9 RC1 发布

    Frugalware Linux 1.9 RC1 发布了,下载地址:fvbe-1.9rc1-full-x86_64.iso (1,874MB, SHA1). 发行通知:http://www.fruga ...