码迷,mamicode.com
首页 > 其他好文 > 详细

Supervisor安装

时间:2014-10-22 13:01:53      阅读:154      评论:0      收藏:0      [点我收藏+]

标签:des   http   io   os   ar   java   sp   文件   on   

转的一篇文章,原文,http://type.so/linux/supervisor-install-and-configure.html
Supervisor安装

安装

easy_install supervisor

生成默认配置文件

echo_supervisord_conf > /etc/supervisord.conf

mkdir /etc/supervisord.conf.d

修改配置文件

include区段修改为

[include]

files = /etc/supervisord.conf.d/*.conf

如需要访问web控制界面,inet_http_server区段修改为

[inet_http_server]

port=0.0.0.0:9001

username=username ; 你的用户名

password=password ; 你的密码

每个需要管理的进程分别写在一个文件里面,放在/etc/supervisord.conf.d/目录下,便于管理。例如:test.conf

[program:sqlparse]

directory = /var/www/python

command = /bin/env python test.py

将supervisord加入系统服务,以下代码来自gist,文件:/etc/init.d/supervisord

!/bin/sh

/etc/rc.d/init.d/supervisord

Supervisor is a client/server system that

allows its users to monitor and control a

number of processes on UNIX-like operating

systems.

chkconfig: - 64 36

description: Supervisor Server

processname: supervisord

Source init functions

. /etc/init.d/functions

RETVAL=0

prog=“supervisord”

pidfile=“/tmp/supervisord.pid”

lockfile=“/var/lock/subsys/supervisord”

start()

{

echo -n $"Starting $prog: "

    daemon --pidfile $pidfile supervisord -c /etc/supervisord.conf

    RETVAL=$?

    echo

    [ $RETVAL -eq 0 ] && touch ${lockfile}

}

stop()

{

echo -n $"Shutting down $prog: "

    killproc -p ${pidfile} /usr/bin/supervisord

    RETVAL=$?

    echo

    if [ $RETVAL -eq 0 ] ; then

            rm -f ${lockfile} ${pidfile}

    fi

}

case “$1” in

start)

start

;;

stop)

stop

;;

status)

status $prog

;;

restart)

stop

start

;;

*)

echo "Usage: $0 {start|stop|restart|status}"

;;

esac

chmod +x /etc/init.d/supervisord

chkconfig supervisord on

service supervisord start

Supervisor安装

标签:des   http   io   os   ar   java   sp   文件   on   

原文地址:http://my.oschina.net/gotham/blog/336103

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!