Iam doing a project in Free BSD and i am stuck with a puzzle. Please any one of you clarify my doubt :
How to add a mechanism to check the status of the file system which alerts the root user via. email if any single partition is greater than 90% full. This alert should include the file system directory name and the partition?
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.
[INDENT]echo "Partition $1 is at $2'%'."
fi
shift;
shift;
((NUM=NUM-1))
done[/INDENT]
}
#=======
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()"