send an alert by mail if partition usage exceeds 95%

This should work:
Code:
#!/bin/sh

# Partition mount point - parameter checks left as an exercise for the reader :-)
MPOINT=$1

# Partition usage
FULL=`df ${MPOINT} | egrep -o '[0-9]+%' | tr -d '%'`

if [ "$FULL" -gt 95 ]; then
	echo "$MPOINT usage exceeds 95%" | mail -s "$MPOINT usage report" admin@my.server
fi

Usage:
the_above_script.sh /my/partiton/mount/point
 
Back
Top