Quote:
Originally Posted by tadakamalla
Iam working on Free BSD 5.3 version.
Now i want to check which partition if greater than 90% full without scanning the first row of record. How to do this ? Please anyone of u help me with this?
This is quick, done early in the morning, but it works. Please don't yell at my 'inefficiencies" ! :>D Streamline it as you will.
It more than likely NEEDS it BADLY.
===========
#!/bin/ksh
get_size () {
IFS="%
"
df -k | grep '\/dev\/' | awk '{ printf "%s\t%d\n",$6,$5 }'
IFS="
"
}
alm_func () {
LIM=$1
shift
NUM=`echo $#/2 | bc`
while [ $NUM -gt 0 ]
doif [ $2 -gt $LIM ]; thenecho "Partition $1 is at $2'%'."
fi
shift;
shift;
((NUM=NUM-1))
done
}
#=======
if [ $# -ne 1 ]; then
echo "$0: Invalid number of arguments"
echo "usage: $0 <filesystem utilization limit>"
exit 1
fi
LIMIT=$1
alm_func $LIMIT `get_size`
======
IFS is usually "<space><tab><\n>" I add the '%'
as a lazy way to make it a field delimiter and 'subtract' it from the 'df -k' output. Dirty, I know. :>D
==
If you want the DEVICE name, substitute '$1' for the '$6' in the AWK statement in "get_size()"
====