I have the following sh file which I originally wrote for HP Unix(which worked great)... but df is different in AIX (HP doesn't have a % in df -k), So I need to remove the % for $x at the moment I'm getting 68% I need it to be 68 so my script complete.
Any help would be welcome.. I'm sure this is a simple thing that slipped my mind..:wall:
#!/bin/ksh
# This script can be used to warn the users that the file system is getting full
#
# Below is set to monitor all the file systems mounted and report to RECEIVER
#
# Usage: as a cron entry for best use.
#set -x
RECEIVER=bja@blank.co.za,gk@blank.co.za,bki@blank.co.za
y=90
# Exclude list of unwanted monitoring, if several partions then use "|" to separate the list
EXCLUDE_LIST="/opt/IBM/TPM|/opt/IBM/SCM|/opt/IBM/ITM"
#LIST=`cat /etc/fstab|grep -v ^#|awk '{print $2}'|grep -vxE "${EXCLUDE_LIST}"`
#LIST=`cat /etc/fstab|grep -v ^#|awk '{print $2}'`
for fs in `df |awk '{ print $NF }'|grep -vxE "${EXCLUDE_LIST}"`
do
#echo fs=$fs
x=`df -k $fs |sed -n " p"| awk '{ print $4 }'`
echo $x
#echo $y
if [ $x -gt $y ]
then
message="File System $fs on `hostname` is $x% used."
#echo $subject
echo $message | mailx -s "`hostname` - File System Full Warning !!!" $RECEIVER
fi
done