supervisor安装与管理

来源:互联网 发布:天下游是什么软件 编辑:程序博客网 时间:2024/05/16 02:21

1.安装

easy_install supervisor

2.配置文件生成

echo_supervisord_conf > /etc/supervisord.conf

3.管理脚本

centos 7

添加文件到

/usr/lib/systemd/system/supervisord.service

文件内容

# supervisord service for systemd (CentOS 7.0+)# by ET-CS (https://github.com/ET-CS)[Unit]Description=Supervisor daemon[Service]Type=forkingExecStart=/usr/bin/supervisord -c /etc/supervisord.confExecStop=/usr/bin/supervisorctl $OPTIONS shutdownExecReload=/usr/bin/supervisorctl $OPTIONS reloadKillMode=processRestart=on-failureRestartSec=42s[Install]WantedBy=multi-user.target
systemctl enable supervisord.servicesystemctl start supervisord

centos 6.5

添加文件到

/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/functionsRETVAL=0prog="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

4.常用命令

管理Supervisor

启动

service supervisord start

关闭

service supervisord stop

重启

service supervisord restart

查看当前监控进程:supervisorctl  status

0 0
原创粉丝点击