I need help with a df script that I pulled from the web. This script is used to monitor disk space and email if it gets over a certain percentage (in this case, 90%). The script works, and it sends me an email, but when I test it I keep getting an output reporting:
dfalert[12]: -: 0403-053 Expression is not complete; more tokens expected.
The name of my script is "dfalert", and it's reporting a problem on line 12 of the script. Here is the code:
+1 ###################################################################
+2 #! /bin/ksh
+3 #
+4 ########################################################################################
+5 # This scripts monitors the disk space utilization and sends an email to the Admins if #
+6 # the amount of disk space for any file system reaches 90% or more. This script will #
+7 # run as an hourly cron job. #
+8 ########################################################################################
+9 #
+10 df -k |grep -iv filesystem |awk '{print $1 "\t" $4 "\t" $7}' |while read LINE; do
+11 PERC=`echo $LINE |cut -d"%" -f1 |awk '{print $2}'`
+12 if [ $PERC -gt 90 ]; then
+13 echo "The Filesystem ${LINE} on `hostname`" |mail -s "Disk Space Alert"
user@host.com
+14 fi
+15 done
Any ideas as to what "tokens" I'm missing on line #12 would be greatly appreciated. Thank you in advance.
outta