服务监控脚本
- - Linux - 操作系统 - ITeye博客已有 0 人发表留言,猛击->> 这里<<-参与讨论. —软件人才免语言低担保 赴美带薪读研.
#!/bin/bash
export JAVA_HOME=/usr/local/java/jdk1.8.0_25
export CLASSPATH=$JAVA_HOME/lib:$JAVA_HOME/jre/lib:$JAVA_HOME/lib/tools.jar
export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH
if ! curl --connect-timeout 30 -m 30 --request GET 'http://127.0.0.1:9098/get_userLvl_status' | grep \"code\":200 ; then
crashtime=$(date)
PID=$(ps -ef |grep /home/java/juxinli_consum/juxinli_consum.jar |grep -v grep |awk '{print $2}')
echo "$crashtime" >>/home/java/juxinli_consum_crash.log
echo $PID
kill -9 $PID
sleep 10
/home/java/start-consum.sh
else
echo success >> /home/java/success.txt
fi