I have a get_script that kicks off the other script. The reason is I'm pulling the same data from several places at once ever 5 minutes.
CRON Entry
1,6,11,16,21,26,31,36,41,46,51,56 * * * * /export/home/scripts/get_mtxcper
cat get_mtxcper
/export/home/scripts/mtxcper STLOMTX &
cat mtxcper
#!/usr/bin/ksh
# echo "Enter switch: \c"
# read switch
# echo "Enter username: \c"
# read username
# echo "Enter password: \c"
# read password
switch=$1
dt=$(date +%m%d%y_%H%M)
username=username
password=password
for x in 1
do
{
sleep 5
echo $username
sleep 3
echo $password
sleep 3
echo "get cper"
sleep 3
echo "exit;"
}|telnet $switch>/export/home/live/cperlive/$switch.txt
done
tail +45 /export/home/live/cperlive/STLOMTX.txt > /export/home/live/cperlive/STLOMTX.LIVE.txt
cat /export/home/live/cperlive/STLOMTX.txt | grep "BHCA" > /export/home/live/cperlive/BHCA.txt
cat /export/home/live/cperlive/STLOMTX.txt | grep "Origination" > /export/home/live/cperlive/Origination.txt
awk '{ print $4, $NF }' < /export/home/live/cperlive/BHCA.txt > /export/home/live/cperlive/CPER_ALERT.txt
awk '{ print $2, $3 }' < /export/home/live/cperlive/Origination.txt >> /export/home/live/cperlive/CPER_ALERT.txt
cat /export/home/live/cperlive/Origination.txt | grep "Voice" > /export/home/live/cperlive/voice.txt
awk '{print $3 }' < /export/home/live/cperlive/voice.txt > /export/home/live/cperlive/percent.txt
sed 's/%//' /export/home/live/cperlive/percent.txt > /export/home/live/cperlive/PERCENT_ALERT.txt
percent=$(< /export/home/live/cperlive/PERCENT_ALERT.txt )
echo "percent='$percent'"
if (( ( percent ) <= 100 )); then
/usr/lib/sendmail -v -f "CPER_ALERT" "
email@address.com" < /export/home/live/cperlive/CPER_ALERT.txt
else
echo "File Not Found"
fi;