Auf einem Server, den ich administriere, läuft in regelmäßigen Abständen die Partition /var voll. Um daraus resultierende Fehler zu vermeiden, habe ich ein kleines Bash-Script geschrieben, dass eine entsprechende Warnung an mich mailt:

#!/bin/bash
# 
# Setting limits
softlimit=90
hardlimit=95
 
# 
# Retrieves line with information about /var 
data=$(df -h | grep '/var')
 
#
# Reads the percentage of file system usage from the data above
percentage=$(echo $data | awk '{ print $5 }')
 
#
# Removes the percentage symbol
count=$(echo $percentage | sed 's/%//')
 
if [ "$count" -gt "$softlimit" ]
then
        if [ "$count" -le "$hardlimit" ]
        then
                echo -n "Warning: File system at $count% capacity!\n
                             Softlimit: $softlimit\n
                             Hardlimit: $hardlimit" | mail -s "Warning: File system at $count% capacity!" user@email
        fi
fi
 
exit #?