网站开发建设公司电话,有哪些做ppt用图片的网站,wordpress skype 插件,安徽省建设部网站官网Linux监控进程#xff0c;进程关闭自动重启方案corntabshell脚本检测进程这个方案简单不用额外安装软件。缺点是存在间隔#xff0c;corntab设置1秒执行一次shell脚本也是存在间隔的#!/bin/bash#author smallForest#email 1032817724qq.comproc_namexiaofei.php …Linux监控进程进程关闭自动重启方案corntabshell脚本检测进程这个方案简单不用额外安装软件。缺点是存在间隔corntab设置1秒执行一次shell脚本也是存在间隔的#!/bin/bash#author smallForest#email 1032817724qq.comproc_namexiaofei.php #进程名字proc_num(){numps -ef | grep $proc_name | grep -v grep | wc -lreturn $num}proc_numnumber$?echo $numberif [ $number -eq 0 ]then#cd /Applications/MAMP/htdocs/aa/bb/public #进入路径nohup php xiaofei.php xiaofei 21 # 创建守护进程fisupervisor方案此方案反应速度快对系统资源消耗较大安装Pythonyum install python-setuptools安装Supervisoreasy_install supervisor查看是否成功echo_supervisord_conf有输出就正确创建目录初始化配置mkdir /usr/supervisorecho_supervisord_conf /usr/supervisor/supervisord.confmkdir /usr/supervisor/supervisord.d/修改系统配置文件vim /usr/supervisor/supervisord.confinclude增加一行[include]files /usr/supervisor/supervisord.d/*.conf启动supervisorsupervisord -c /usr/supervisor/supervisord.conflsof -i:9001查看端口创建子配置文件vim /usr/supervisor/supervisord.d/supervisor_test_one.conf输入[program:test_one]commandphp /root/lianxi_php/xiaofei.php ; 被监控的进程路径priority1 ; 数字越高优先级越高numprocs1 ; 启动几个进程autostarttrue ; 随着supervisord的启动而启动autorestarttrue ; 自动重启startretries10 ; 启动失败时的最多重试次数exitcodes0 ; 正常退出代码stopsignalKILL ; 用来杀死进程的信号stopwaitsecs10 ; 发送SIGKILL前的等待时间redirect_stderrtrue ; 重定向stderr到stdout重新启动supervisorsupervisord -c /usr/supervisor/supervisord.conf会有一个supervisor 输入reload这是顺利情况下。不顺利的话就需要不停的查看日志了