Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Automating page interval

Status
Not open for further replies.

icu812

MIS
Sep 10, 2001
52
0
0
US
I have a script. It works fine, except I have it running through CRON every 5 minutes and when it encounters a process that is down, I get a page every five minutes.I'd like CRON to run the script every five minutes but I want to get paged every hour when a problem is encountered. Does anyone have any suggestions???? Thanks

cat oradbproc.lis | while read LINE
do
SERVER=`echo $LINE|cut -f1 -d :`
PROC=`echo $LINE|cut -f2 -d :`
USER=`echo $LINE|cut -f3 -d :`
MAILMSG=`echo $LINE|cut -f4 -d :`
RC=1

ping -c 5 "$SERVER" 1>/dev/null 2>/dev/null
if [ $? = 1 ]
then
clear
echo "\n\n\n"
echo "Server: "$SERVER" is not available......\n"
echo "Contact UNIX Support.....\n\n\n"
set $RC=0
else
dsh -w "$SERVER" ps -ef|grep "$PROC"|grep "$USER"|grep -v grep 1>/dev/null 2>/
dev/null
if [ $? = 1 ]
then
echo "$MAILMSG"|mail -s ORACLE ALERT 444-5555@archwireless.net
set $RC=0
fi
fi
done
 
You could add logic to the script to do that
or you could create a identical script and cron job
that does the paging, but only runs once an hour. Robert G. Jordan
Unix Sys Admin
Sleepy Hollow, Illinois U.S.A.
sh.gif


FREE Unix Scripts
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top