码迷,mamicode.com
首页 > 其他好文 > 详细

小小的程序监控脚本

时间:2018-06-24 23:41:00      阅读:156      评论:0      收藏:0      [点我收藏+]

标签:url   mac   restart   emctl   name   amp   emc   error   ack   

1. dog_fs_curl.sh

more dog_fs_curl.sh 
#!/bin/bash
while true
do
  status=$(ps aux|grep fs-curl | grep -v grep | grep -v bash | wc -l)
  currdate=$(date "+%Y-%m-%d %H:%M:%S")
  if [ "${status}" = "0" ]; then
    echo "${currdate} - fs-curl process is down!!! error!!!" >> curl.err
    cd /opt/program/fs-curl
    sudo java -jar -Dddg.sys.name=CC_VOIP fs-curl.jar &
    
    sleep 2
    currdate=$(date "+%Y-%m-%d %H:%M:%S")
    echo "${currdate} - fs-curl restart over, recheck status." >> curl.err

    status2=$(ps aux|grep fs-curl | grep -v grep | grep -v bash |wc -l)
      if [ "${status2}" = "0"  ]; then
        echo "${currdate} - fs-curl can not restart, start backup machine!!!" >> curl.err
        sudo systemctl stop keepalived.service
      fi
  fi
  sleep 2
done

 

小小的程序监控脚本

标签:url   mac   restart   emctl   name   amp   emc   error   ack   

原文地址:https://www.cnblogs.com/yoyotl/p/9088954.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!