I got an error when running this script (from BigAdmin community)
the error is
test: argument expected
my server version is
SunOS XXX 5.8 Generic_117350-46 sun4u sparc SUNW,Sun-Fire-V890
any idea on it?
#! /usr/bin/ksh
###
### This script can be run from cron to periodically check
### filesystems for low disk space and send an e-mail.
###
### Variables:
### MAXSIZE = percentage filesystem must be full before notification
### NOTIFY = email address to notify when file system reaches MAXSIZE
###
### Configurable variables here
MAXSIZE=90
NOTIFY=xxx@domain.com
HOSTNAME=`hostname`
# Add filesystems you wish to skip from checking
FSLIST=`df -k | grep -v "cdrom" | grep -v "mnt" | awk '{ \
fssize=substr($5,1,index($5,"%")-1)
if (int(fssize) > int(maxsize)) {
print $6":"fssize
}
}' maxsize=$MAXSIZE`
### Were there any fs to report?
if [ -z $FSLIST ]; then
echo "There were no reportable filesystems."
exit 0
fi
### Mail out the list if there is one
for fs in $FSLIST
do
FS=`echo $fs | cut -f1 -d:`
SIZE=`echo $fs | cut -f2 -d:`
MESSAGE="Subject: $HOSTNAME File System Alert: $FS at $SIZE %"
echo $MESSAGE | mail $NOTIFY
done
### Exit gracefully
exit 0