pythond进程管理软件 supervisor 3.3.3 配置文件以及开机启动
2018-02-01 12:04
676 查看
配置如下(/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
}
运行命令:
[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完成开机启动配置。
相关文章推荐
- 使用Python的Supervisor进行进程监控以及自动启动
- python启动办公软件进程(word、excel、ppt、以及wps的et、wps、wpp)
- 使用Python的Supervisor进行进程监控以及自动启动
- supervisor开机自动启动脚本+redis+MySQL+tomcat+nginx进程自动重启配置
- 使用Python的Supervisor进行进程监控以及自动启动
- 打印配置文件nginx.conf内容的行号及内容和开机启动软件设置和查看配置文件总行数
- java 高新技术【6】 反射开发框架以及用 类加载器 管理资源和配置文件
- windows环境下配置python脚本的开机启动
- 深入理解linux下rc.d/目录文件以及程序开机自启动
- 使用Python的Supervisor来管理进程
- (转载)Linux 配置文件简介/登录注销,文件系统,系统管理,守护进程,用户程序配置文件/Understanding Linux configuration files
- 使用supervisor 管理python进程
- 监听总结之解析问题二:由sqlnet.ora文件寻到EZCONNECT适配器程序来解析主机名为主机上的多个ip地址(*) 以及 tnsping是用来测试某个配置的监听程序是否启动
- supervisor - Python进程管理工具
- windows环境下配置python脚本的开机启动
- Centos 6.3安装配置supervisor进程管理工具
- MFC_开机后软件启动管理程序
- SUSE开机启动脚本配置文件
- python创建子进程,以及读取配置文件方法