centos7使用supervisor的详细教程
supervisor是用Python开发的一套通用的进程管理程序,可以将一个普通的命令行进程变为后台daemon,并监控进程状态,异常退出时可以自动重启
安装supervisor
#yumsearchsetuptools .... python-setuptools.noarch:EasilybuildanddistributePythonpackages #yuminstall-ypython-setuptools.noarch #easy_installsupervisor
创建主配置文件
#mkdir-m755-p/etc/supervisor \\创建supervisor配置文件目录 #echo_supervisord_conf>/etc/supervisor/supervisord.conf \\创建主配置文件 #cd/etc/supervisor/ #mkdir-m755conf.d \\创建项目配置文件目录
创建项目配置文件(运行3个脚本)
#vimconf.d/test.ini [program:tjapp_sendmessage] command=/bin/bash/data/shell/sendmessage.sh numprocs=1 autostart=true autorestart=true [program:bbscollection] command=/bin/bash/data/shell/bbscollection.sh numprocs=1 autostart=true autorestart=true [program:test_sbbscollection] command=/bin/bash/data/shell/test_sbbscollection.sh numprocs=1 autostart=true autorestart=true
在主配置文件中引入test.ini
#catsupervisord.conf ... [include] files=./conf.d/*.ini
启动supervisor
#supervisord-c/etc/supervisord.conf
查看supervisor运行的脚本
#supervisorctl bbscollectionRUNNINGpid10090,uptime4days,17:20:10 test_sbbscollectionRUNNINGpid10088,uptime4days,17:20:10 tjapp_sendmessageRUNNINGpid10089,uptime4days,17:20:10
停止bbscollection脚本
#supervisorctlstopbbscollection bbscollection:stopped [root@om-web_testsupervisord.d]#supervisorctl bbscollectionSTOPPEDApr0610:23AM test_sbbscollectionRUNNINGpid10088,uptime4days,17:23:13 tjapp_sendmessageRUNNINGpid10089,uptime4days,17:23:13 supervisor>startbbscollection\\启动 supervisor>status bbscollectionRUNNINGpid7310,uptime0:00:24 test_sbbscollectionRUNNINGpid10088,uptime4days,17:23:54 tjapp_sendmessageRUNNINGpid10089,uptime4days,17:23:54
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持毛票票。
热门推荐
1 训练狗狗憋尿
2 狗狗追踪训练
3 狗狗训练要多少钱
5 深圳狗狗训练
6 训练狗狗唤回
7 狗狗叫怎么训练
8 狗狗训练班
10 狗狗社会化训练
11 狗狗叫回训练
12 广州狗狗训练学校
13 狗狗训练躺下
14 狗狗随行训练
15 训练狗狗巡回
16 狗狗要怎么训练
17 狗狗喂食训练
18 训练狗狗躺下