#!/bin/sh ## give max disk usage in %, after that a warning will be produced MAX=15 ## looks for mounted filesystems, but not proc,sys,... DISKS=`mount |grep -iv proc |grep -iv sysfs |awk '{print $3}'` for DISK in $DISKS; do USAGE=`df -k $DISK | tail -n 1 | awk '{print $5}' | cut -d"%" -f1` # if no number is given as percentage, do nothing echo "$USAGE" |grep -q [0-9] && if [ $USAGE -gt $MAX ]; then echo "`uname -n` $DISK is at ${USAGE}% capacity" | mail -s "[diskspace] $DISK explodiert gleich" root@mutter.sao fi done