# Check to see if the output file exists. # If it does, it means there was a previous error # that has not yet been cleared, so do not run. # This prevents duplicate emails. if [ -f fs_error.txt ] ; then exit else # # Set the device for the file system you want to monitor # and the minimum space in MB fs_dev=c0d0p3 fs_min=100 fs_size=`df | grep $fs_dev | awk '{print $4/1024}'` fs_size=`echo $fs_size|awk -F \. '{print $1}'` echo $fs_size if [ $fs_size -lt $fs_min ] ; then touch fs_error.txt mail -s "Root file system low!" youremail@yourdomain.com fi fi