supervisor监控gearman任务
安装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任务的更多相关文章
- [erlang]supervisor(监控树)的重启策略
1. init函数 init() -> {ok, {SupFlags, [ChildSpec,...]}} | ignore. [ChildSpec,...] 是在init之后默认要启动的子进程 ...
- 使用supervisor监控进程
在linux下监控进程,可以使用inittab,最近找到了supervisor,也很好用,记录一下:1.系统要安装python,并安装与之对应的setuptools,下载地址在此2.安装:# sh s ...
- nodemon 或者 Supervisor 监控 Express4.x的代码改动
Express 4.x 默认将启动模块分离到了./bin/www中,直接使用 supervisor/nodemon 无法正常监控应用,使得开发过程中的调试非常不方便.所以我们直接把./bin/www中 ...
- [Erlang13]怎么把一个普通的进程挂入Supervisor监控树?
简单来说:应该是在调用的start_link返回一个{ok,Pid}就可以把这个进程放入监控树Supervisor里面: -module(worker). -author("zhongwen ...
- Python学习笔记【Supervisor】:使用Supervisor监控Tornado进程
Linux常见应用服务配置模式nginx和supervisor:采用主配置文件+项目配置文件 安装(如果使用pip安装注意看是否需要指定使用python2版本) 第一步:在Linux中使用apt-ge ...
- supervisor 监控redis & mongodb
安装 安装python brew install python 安装pipwget https://bootstrap.pypa.io/get-pip.pysudo python get-pip.py ...
- 分布式的任务分发框架-Gearman
官方文档:http://gearman.org/getting-started/ 安装方法和示例都有,可以详细看一下. Gearman是一个分发任务的程序框架,可以用在各种场合,与Hadoop相比,G ...
- 【supervisor】监控服务
写了一个ftp服务,用supervisor监控一下 1.先写一个配置文件,路径和名称为/etc/supervisord.conf.d/ftp-server.ini [program:ftp-serve ...
- 关于supervisor无法监控golang代码的解决方法
之前一直都是使用如下方式运行go代码 # go run test.go 这种运行方式是直接编译运行go代码,虽然在调试的时候没出什么问题,但是在使用supervisor监控的时候,会提示如下错误:(b ...
随机推荐
- (mysql)Packet for query is too large
http://jingyan.baidu.com/article/fb48e8be3f81716e622e14ee.html windows如何重启mysql 开始->运行->cmd 停止 ...
- MyBatis框架——mybatis插入数据返回主键(mysql、oracle)
向数据库中插入数据时,大多数情况都会使用自增列或者UUID做为主键.主键的值都是插入之前无法知道的,但很多情况下我们在插入数据后需要使用刚刚插入数据的主键,比如向两张关联表A.B中插入数据(A的主键是 ...
- 添加ModelGoon插件Eclipse自动生成UML图
下载ModelGoonjar包 http://download.csdn.net/detail/u011070297/8366021 下载完该jar之后,直接拷贝到Eclipse安装目录下的dropi ...
- git clone 错误ca-certificates.crt
git clone https://github.com/baoyiluo/selfblog.git Cloning into 'selfblog'... error: server certific ...
- Android--广播机制
1.Android中广播分为两种类型: 1)标准广播:完全异步执行的广播,在广播发出后,所有的广播接收器几乎会在同一时刻接收到,它们之间没有顺序可言,效率高,不可截断: 2)有序广播:同步执行的广播, ...
- ASP.NET MVC学习之模型绑定(2)
3.手工调用模型绑定 很多情况下我们都是通过形参的方式接收来自http流中的数据,这看似是完美的,但是缺少了很多过程中的控制,所以我们就需要使用手工的方式进行绑定.下面我们通过一个例子来说明,首先打开 ...
- 用c#开发微信 (10) JS-SDK 基本用法- 分享接口“发送到朋友”
微信JS-SDK是微信公众平台面向网页开发者提供的基于微信内的网页开发工具包.通过使用微信JS-SDK,网页开发者可借助微信高效地使用拍照.选图.语音.位置等手机系统的能力,同时可以直接使用微信分享. ...
- [Microsoft Test Manager]CodeUI初探
开发环境: Widnows8 Microsoft Visual Studio Ultimate 2012 1. 新建一个 Windows Forms Application Figue1 Cr ...
- C#笔试题(一)
一.下面是一个由*号组成的4行倒三角形图案. 要求: 1.输入倒三角形的行数,行数的取值3-21之间,对于非法的行数,要求抛出提示"非法行数!": 2.在屏幕上打印这个指定了行数的 ...
- listen--监听数量
listen--监听数量 #include <sys/socket.h> int listen(int sockfd, int backlog); /* backlog指定了该套接口排队的 ...