Sie sind auf Seite 1von 1

################################################################################

###

#!/bin/sh
df -H | grep -vE '^Filesystem|tmpfs|cdrom' | awk '{ print $5 " " $1 }' | while r
ead output;
do
echo $output
usep=$(echo $output | awk '{ print $1}' | cut -d'%' -f1 )
partition=$(echo $output | awk '{ print $2 }' )
if [ $usep -ge 90 ]; then
echo "Running out of space \"$partition ($usep%)\" on $(hostname) as on $(da
te)" |
mail -s "Alert: Almost out of disk space $usep%" you@somewhere.com
fi
done

################################################################################
###
################################################################################
###
#!/usr/bin/ksh
HOSTNAME=$(uname -n)
PATH=/usr/bin
export HOSTNAME PATH
Threshold=90
df -k|tail +2|awk '!/proc/&&!/mnttab/&&!/fd/&&!/swap/ {print $6,$5}'|while read
fs pctused; do
if [ "${pctused%%\%}" -gt $Threshold ]; then
## send mail, filesystem usage is above treshold
:
else
## do nothing?
:
fi
done

Das könnte Ihnen auch gefallen