您好,登錄后才能下訂單哦!
小編給大家分享一下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進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。