利用shell脚本监控程序日志是否正常刷新,并且重启相关程序。
脚本如下:
#!/bin/bash LOGFILE="/slview/ITE-PON-NEW/resin/log/jvm-default.log" RESINPATH="/slview/ITE-PON-NEW/resin/" while true do LOGWC1=`wc -l ${LOGFILE} | awk '{print $1}'` sleep 600 LOGWC2=`wc -l ${LOGFILE} | awk '{print $1}'` if [ $LOGWC1 -eq $LOGWC2 ];then ${RESINPATH}/bin/httpd.sh restart DIR=`cd "$( dirname "$0" )" && pwd` DATA_YMDHM=`date +%Y%m%d%H%M` echo "${DATA_YMDHM}检查到异常,完成重启" >> ${DIR}/resin_log_check.log fi done
发表评论