#!/bin/ksh # See if listener is running. lsnr_up=`ps -eaf |grep lsnr |grep -v grep |wc -l` # If not, see if database is running . . . if test $lsnr_up -eq 0 then pmon_up=`ps -eaf |grep -i pmon |\ grep -v grep |wc -l` smon_up=`ps -eaf |grep -i smon |\ grep -v grep |wc -l` dbwr_up=`ps -eaf |grep -i dbwr |\ grep -v grep |wc -l` lgwr_up=`ps -eaf |grep -i lgwr |\ grep -v grep |wc -l` # If database is up, restart listener if test $pmon_up -gt 0 && test $smon_up -gt 0 && test $dbwr_up -gt 0 && test $lgwr_up -gt 0 then # Oracle is up lsnrctl start $1 # Start tnslsnr echo 'Started tnslsnr ' `date` fi fi