shell脚本监控监听器进程

来源:互联网 发布:电子数据交换技术ppt 编辑:程序博客网 时间:2024/05/20 04:48

脚本代码如下:

#!/bin/bash
. /home/oracle/.bash_profile
tempfile=/oracle/admin/$ORACLE_SID/tempfile.lis
lsnrctl status > $tempfile
if [ $?!=0 ]
then
   echo " " >> $tempfile
   echo "=============================================" >> $tempfile
   echo " " >> $tempfile
   date >> $tempfile
   echo "Listener is down, restarting it agin." >> $tempfile
   lsnrctl start >> $tempfile


   if [ $?=0 ]
   then
      mail zgk_baqi@126.com -s "Listener is restarted." < $tempfile
   else
      mail zgk_baqi@126.com -s "Listener is down, restarting failed." < $tempfile
   fi
 fi
rm -f $tempfile

原创粉丝点击