小编给大家分享一下shell如何根据文件时间有无更新进行报警,希望大家阅读完这篇文章之后都有所收获,下面让我们一起去探讨吧!
!/bin/sh
export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/data/oracle/product/ora10/lib
export TNS_ADMIN=/data/oracle/product/ora10/network/admin
export ORACLE_HOME=/data/oracle/product/ora10
export ORACLE_SID=dbmisc
LOG="/data/oracle/product/ora10/network/log/listener.log"
DIR="/home/shell/hostmonitor/logs"
MAILLIST="pso@datou.com"
LOGDATE=`date +%s -r $LOG`
CURDATE=`date +%s`
COUNT=`expr $CURDATE - $LOGDATE`
if [ $COUNT -ge 300 ];then
cat << EOF > $DIR/listener.txt
#ps -ef|grep oracle|grep LISTENER
#lsnrctl start
EOF
mailx -s "####### 192.168.1.208 dbmisc listener alert #######" $MAILLIST < $DIR/listener.txt
$ORACLE_HOME/bin/sqlplus /nolog << EOF
connect dtuser_smsold/datuu
insert into dt_smssend (numsmssendid,vc2enabledflag,datcreation,vc2to,vc2content,vc2url,vc2source) values(dtseq_smssend.nextval,'Y',sysdate,'13691343631','192.168.1.208 dbmisc listener have problem!','','');
insert into dt_smssend (numsmssendid,vc2enabledflag,datcreation,vc2to,vc2content,vc2url,vc2source) values(dtseq_smssend.nextval,'Y',sysdate,'13810607733','192.168.1.208 dbmisc listener have problem!','','');
exit;
EOF
fi
看完了这篇文章,相信你对“shell如何根据文件时间有无更新进行报警”有了一定的了解,如果想了解更多相关知识,欢迎关注亿速云行业资讯频道,感谢各位的阅读!
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。