-
Hi,
I am using oracle apps 11i and i require a script where i use to run in cron every minute to see if a particular listener is down or if a concurrent manager is down,??
any ideas?
thanks
-
script
Hello All,
i need a script to watch the listener. If it goes down then i want he script to bring it back up via cron
-
I don't have one written but it shouldn't be too hard. Just have the script ps -ef | grep for what you're looking for, if it's not there, start it up.
listeners run off the lsnr process, so grep for "lsnr listner_name"
for concurrent managers i think you can just grep -i concurrent
-
#!/bin/ksh
# @(#)listenerwatch 1.6 00/12/14 14:27:57
# set hostname
hn=`hostname`
DATA_DIR=$HOME/scripts/listenerwatch
DATA_FILE=$DATA_DIR/$hn.dat
MAX_FAILED=3
# check to make sure listener is up
if (( `ps -ef | grep lsnr | grep -v grep | grep -v "sh " | wc -l` == 0)); then
let numfail=`cat $DATA_FILE`
# attempt to restart
if ( $ORACLE_HOME/bin/lsnrctl start > /dev/null 2>&1 ); then
# Listener was restarted successfully, reset counter in data file.
mailx -s "Listener Restarted ("`hostname`")" oracle << EOF
`basename $0` has detected that the listener has died on `hostname`.
The Listener was restarted successfully.
EOF
# if everything is OK, indicate in the DATA_FILE
touch $DATA_FILE; rm -f $DATA_FILE; echo 0 > $DATA_FILE
else
if (( $numfail < $MAX_FAILED )) ; then
if (( ($numfail +1) == $MAX_FAILED )) ; then
# if this is the last attempt, page people
mailx -s "Listener Down? ("`hostname`")" oracle.oncall << EOF
`basename $0` has detected that the Listener has died on `hostname`.
The Listener was NOT restarted successfully.
EOF
else
# send mail indicating you couldn't restart listener
mailx -s "Listener Down? ("`hostname`")" oracle << EOF
`basename $0` has detected that the Listener has died on `hostname`.
The Listener was NOT restarted successfully.
EOF
fi
touch $DATA_FILE; rm -f $DATA_FILE; echo "$(($numfail +1))" > $DATA_FILE
fi
fi
else
touch $DATA_FILE; rm -f $DATA_FILE; echo 0 > $DATA_FILE
fi
Jeff Hunter
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|