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!

script problem

Status
Not open for further replies.

icu812

MIS
Sep 10, 2001
52
0
0
US
I have a script that looks like this:
it works fine but I have it running every 15 minutes through cron and when my condition is met I get 4 pages an hour until it has been resolved. Can someone please assist me in getting this script to run every 15 minutes and only page me once???? Thanks
## This portion of the script monitors power to SP nodes
##
spmon -d|awk '{print $2":"$4}' > /tmp/mon_power.out
grep off /tmp/mon_power.out > /tmp/mon_power2.out
if [ $? -eq 0 ]
then mail -s &quot;SP node power out msg&quot; 4556720@archwireless.net < /tmp/mon_sp_powe
r2.out
mail -s &quot;SP node power out msg&quot; 4550720@archwireless.net < /tmp/mon_sp_power2.ou
t
fi
 
p=0
while :
do

spmon -d|awk '{print $2&quot;:&quot;$4}' > /tmp/mon_power.out
grep off /tmp/mon_power.out > /tmp/mon_power2.out
if [ $? -eq 0 ]
then
if [ &quot;$p&quot; -eq &quot;0&quot; ]
then
mail -s &quot;SP node power out msg&quot; 4556720@archwireless.net < /tmp/mon_sp_power2.out
mail -s &quot;SP node power out msg&quot; 4550720@archwireless.net < /tmp/mon_sp_power2.out
p=1
fi
else
p=0
fi

sleep 900

done


This should get you close.

Bill.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top