1.

Solve : HELP!!! script check for status if see something then send email.?

Answer»

autorep -m bogus

Machine Name Max Load Current Load Factor O/S Status
___________ ________ ___________ ______ ________ ______
bogus --- --- 1.00 Sys AGENT Online


Status
______
Online
Offline
Missing
Unqualified


The "Status" always "Online". I like create a SCRIPT execute run 24/24 with command "break" and check if see not "Online" if see (Offline, Missing, Unqualified.....etc) then send out email. Can someone help on this code SYNTAX....I can't make it work. Thanks

Quote

#!/bin/ksh

CHECK_MACHINE=`autorep -m bogus | awk '{print $NF}' | awk 'NR>3' | grep -V Online

##for file in ${CHECK_MACHINE}
##do
##if

while [ ${CHECK_MACHINE} -eq Offline|Missing|Unqualified ]
do

CHECK_MACHINE=autorep -m bogus | awk '{print $NF}' | awk 'NR>3' | grep -v Online


if [ ${CHECK_MACHINE} = Offline|Missing|Unqualified ]
then
sleep 10; echo "Check the agent is [${CHECK_MACHINE}]" | mailx -s "WARNING --The agent is [${CHECK_MACHINE}]" [emailprotected]
break
fi
done


Discussion

No Comment Found