#!/usr/bin/ksh
#LOGFILE=/var/opt/ixos/log/notification_warning.log
#DAT1=/var/opt/ixos/monitor/percentages.dat
#DAT2=/var/opt/ixos/monitor/mountpoints.dat
THRESHOLD=75
#`rm $DAT1`
#`rm $DAT2`
`bdf | grep /var/opt/ixos | awk '{ print $4 }' | cut -f1 -d"%" > test.dat` `bdf | grep /var/opt/ixos | awk '{ print $5 }' > test2.dat`
set -A PERCENTAGES `cat test.dat`
set -A MOUNTPOINTS `cat test2.dat`
len=${#PERCENTAGES[*]}
i=0
while [ $i -lt $len ] do
value=${PERCENTAGES[$i]}
if ( $value > $THRESHOLD ) then
echo "${MOUNTPOINTS[$i]} IS ${PERCENTAGES[$i]}% FULL RIGHT NOW....please increase the space soon."
fi
(( i=i+1 ))
done
exit 0
The above is working just fine for me except that the $value > $THRESHOLD comparison fails. PERCENTAGES is simply an array of numbers (actually strings) that I want to cue off of and only write a line to a log file if the value is above whatever THRESHOLD is set to. Sounds easy enough but apparently shell script math and I don't get along.
Any help is appreciated.