pythond进程管理软件 supervisor 3.3.3 配置文件以及开机启动

配置如下(/etc/supervisord.conf):

[unix_http_server]                 ; supervisord的unix socket服务配置
file=/tmp/supervisor.sock          ; socket文件的保存目录

#[inet_http_server]                 ; supervisord的tcp服务配置
#port=0.0.0.0:9090                  ; tcp端口
#username=                 ; tcp登陆用户
#password=              ; tcp登陆密码

[supervisord]                      ; supervisord的主进程配置
logfile=/data/log/supervisord.log  ; 主要的进程日志配置
logfile_maxbytes=50MB              ; 最大日志体积,默认50MB
logfile_backups=10                 ; 日志文件备份数目,默认10
loglevel=info                      ; 日志级别,默认info; 还有:debug,warn,trace
pidfile=/var/run/supervisord.pid   ; supervisord的pidfile文件
nodaemon=false                     ; 是否以守护进程的方式启动
minfds=1024                        ; 最小的有效文件描述符,默认1024
minprocs=200                       ; 最小的有效进程描述符,默认200
user=root                          ; 默认为当前用户,如果为root则必填
childlogdir=/data/log              ; ('AUTO' child log dir, default $TEMP)

[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface

[supervisorctl]
serverurl=unix:///tmp/supervisor.sock

;;;;;;;;;;;;;;;;;;;;;;;;;;;;

[program:BT_local]
command=/usr/bin/beanstalkd -l 0.0.0.0 -p 11300 -b /data/beanstalk/local -f 1000 -z 10485759

[program:uwsgi]
command=/data/web/venv/bin/uwsgi --ini /data/web/app_uwsgi.ini

[program:explain_excels]
command=/usr/bin/python /data/web/explain_excels.py

设置开机启动(/etc/init.d/supervisord):

#! /usr/bin/env bash
# chkconfig: - 85 15

PATH=/sbin:/bin:/usr/sbin:/usr/bin

PROGNAME=supervisord

DAEMON=/usr/bin/$PROGNAME

CONFIG=/etc/$PROGNAME.conf

PIDFILE=/var/run/$PROGNAME.pid

DESC="supervisord daemon"

SCRIPTNAME=/etc/init.d/$PROGNAME

# Gracefully exit if the package has been removed.

test -x $DAEMON || exit 0


start()

{

    echo -n "Starting $DESC: $PROGNAME"

    $DAEMON -c $CONFIG

    echo ".............start success"

}

stop()

{

    echo "Stopping $DESC: $PROGNAME"

    if [ -f "$PIDFILE" ];
    then
        supervisor_pid=$(cat $PIDFILE)
        kill -15 $supervisor_pid
        echo "......"
        echo "stop success"
    else
        echo "$DESC: $PROGNAME is not Runing"
        echo ".........................stop sucess"
    fi
}
status()

{
    if [ -f "$PIDFILE" ];
    then
        supervisor_pid=$(cat $PIDFILE)
        echo "$DESC: $PROGNAME is Runing pid=$supervisor_pid"
    else
        echo "$DESC: $PROGNAME is not Runing"
        echo "please use command /etc/init.d/supervisord start Run the service"
    fi
}

case "$1" in

start)

start

;;

stop)

stop

;;

restart)

stop

start

;;

status)

status

;;

*)

echo "Usage: $SCRIPTNAME {start|stop|restart}" >&2

exit 1

;;

esac

exit 0

运行命令:

chkconfig --add suervisord
完成开机启动配置。






评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值