监控log

#!/bin/sh

filedate=`date +%Y%m%d`
logdate=`date +%Y-%m-%d-%H -d "1 hour ago"`
resultdate=`date +%Y%m%d-%H`
hostname=`hostname`

cd /opt/wwwlogs/nginxlog/
#
#mv -f access.log  wap-access-$logdate.log
#
#mv -f error.log error-$logdate.log
#
#kill -USR1 `cat /usr/local/nginx/nginx.pid`
#
##scp wap-access-$logdate.log [email protected]:/data/log/nginx/$filedate/$hostname-log.$resultdate.seq
#
##remove log 3 days ago
#old_date=`date +%Y-%m-%d-%H -d"-5 day"`
#rm -f wap-access-$old_date.log
#rm -f error-$old_date.log

cnt=`grep "accept.go" wap-access-$logdate.log | wc -l`
echo $cnt
if [ $cnt -eq 0 ]
then
  curl -q http://10.13.81.10:10001/mail?appId=1001\&[email protected],[email protected]\&subject=fetch_warning\&content=fetch%20accept.go%20has%20no%20request
  #curl -q http://*************/mail?appId=1001\&[email protected]\&subject=fetch_warning\&content=fetch%20accept.go%20has%20no%20request
  curl -q http://8888888888888001/sms?appId=1001\&to=15900,182\&msg=fetch%20accept.go%20has%20no%20request
  #curl -q http://*************/sms?appId=1001\&to=15901484030\&msg=fetch%20accept.go%20has%20no%20request
fi
~                  

你可能感兴趣的:(log)