centos7使⽤supervisor的详细教程
supervisor是⽤Python开发的⼀套通⽤的进程管理程序,可以将⼀个普通的命令⾏进程变为后台daemon,并监控进程状态,异常退出时可以⾃动重启
安装supervisor
# yum search setuptools
....
#yum install -arch
#easy_install supervisor
创建主配置⽂件
# mkdir -m 755 -p /etc/supervisor
\\创建supervisor配置⽂件⽬录
# echo_supervisord_conf >/etc/f
\\创建主配置⽂件
# cd /etc/supervisor/
# mkdir -m 755 conf.d
\\创建项⽬配置⽂件⽬录
创建项⽬配置⽂件(运⾏3个脚本)
# vim conf.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
#f
...
[include]
files = ./conf.d/*.ini
启动supervisor
# supervisord -c /f
查看supervisor运⾏的脚本
# supervisorctl
bbscollection RUNNING pid 10090, uptime 4 days, 17:20:10
python安装教程非常详细test_sbbscollection RUNNING pid 10088, uptime 4 days, 17:20:10
tjapp_sendmessage RUNNING pid 10089, uptime 4 days, 17:20:10
停⽌bbscollection脚本
# supervisorctl stop bbscollection
bbscollection: stopped
[root@om-web_test supervisord.d]# supervisorctl
bbscollection STOPPED Apr 06 10:23 AM
test_sbbscollection RUNNING pid 10088, uptime 4 days, 17:23:13
tjapp_sendmessage RUNNING pid 10089, uptime 4 days, 17:23:13
supervisor> start bbscollection \\启动
supervisor> status
bbscollection RUNNING pid 7310, uptime 0:00:24
test_sbbscollection RUNNING pid 10088, uptime 4 days, 17:23:54
tjapp_sendmessage RUNNING pid 10089, uptime 4 days, 17:23:54
以上就是本⽂的全部内容,希望对⼤家的学习有所帮助,也希望⼤家多多⽀持。
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论