Ubuntu下监控服务
Ubuntu下监控服务,本方案是根据端口号,如果此端口号不活动,则认为服务停止,那么就重启服务
#!/bin/bash cur_dateTime=`date +%Y-%m-%d,%H:%m:%S` a=`lsof -i:8082 | wc -l` if [ "$a" -gt "0" ];then /bin/bash /opt/cook-prod/backend/restart.sh echo "$cur_dateTime cook running" >> /opt/job/log/cook_restart.job else echo "$cur_dateTime restart job" >> /opt/job/log/cook_restart.job fi
---栖息之鹰(一个外表懒洋洋的内心有激情的程序员)
此博客为笔者原著,转载时请注明出处,谢谢!