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
 
I would suggest having two cron entries and modifying your script to look for a commandline parameter. Something like this:

0 * * * * /dir/monitor.sh -mail
5,10,15,20,25,30,35,40,45,50,55 * * * * /dir/monitor.sh


Then in you script do a
Code:
if [ "$1" = "-mail" ]
 ... # your mail message stuff
if

Hope this helps.
Einstein47
(Love is like PI - natural, irrational, endless, and very important.)
 
Hello,
If you are running Oracle and wants to make sure Oracle process stay running. do vmtune and tune the memory so the working pages never get page out to paging space and not have to worry about if the process is there or not.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top