#!/bin/sh -u # This shell script check the file system increasing size. # Put it in the cron for best results ( each 20 minutes is a good idea !!! ) # Read the File System df -k|awk '{ print $1 }' > /tmp/check_fs.tmp exec < /tmp/check_fs.tmp read FS_Title read FS1 read FS2 read FS3 read FS4 read FS5 read FS6 rm /tmp/check_fs.tmp VALUE1=`df -k|grep $FS1|awk '{ print $5 }'|awk -F"%" '{ print $1 }'` if [ $VALUE1 -gt 89 ] then date >> check_fs.err echo " The filesystem $FS1 is at $VALUE1% !!!. Please check the file " >> check_fs.err #mail -d rbassoi@yahoo.com.br < check_fs.err #cat check_fs.err | mail -s " Warning ! / with $VALUE1%" mixilo@yahoo.com #cat check_fs.err | mail -s " Warning ! / with $VALUE1%" awcogo@alcatel.com.br fi VALUE2=`df -k|grep $FS2|awk '{ print $5 }'|awk -F"%" '{ print $1 }'` if [ $VALUE2 -gt 89 ] then date >> check_fs.err echo " The filesystem $FS2 is at $VALUE2% !!!. Please check the file " >> check_fs.err #mail -d rbassoi@yahoo.com.br < check_fs.err #cat check_fs.err | mail -s " Warning ! /boot with $VALUE2%" rbassoi@yahoo.com.br #cat check_fs.err | mail -s " Warning ! /boot with $VALUE2%" mixilo@yahoo.com #cat check_fs.err | mail -s " Warning ! /boot with $VALUE2%" awcogo@alcatel.com.br fi VALUE3=`df -k|grep $FS3|awk '{ print $5 }'|awk -F"%" '{ print $1 }'` if [ $VALUE3 -gt 89 ] then date >> check_fs.err echo " The filesystem $FS3 is at $VALUE3% !!!. Please check the file " >> check_fs.err #cat check_fs.err | mail -s " Warning ! /home with $VALUE3%" rbassoi@yahoo.com.br #cat check_fs.err | mail -s " Warning ! /home with $VALUE3%" mixilo@yahoo.com #cat check_fs.err | mail -s " Warning ! /home with $VALUE3%" awcogo@alcatel.com.br fi VALUE4=`df -k|grep $FS4|awk '{ print $5 }'|awk -F"%" '{ print $1 }'` if [ $VALUE4 -gt 89 ] then date >> check_fs.err echo " The filesystem $FS4 is at $VALUE4% !!!. Please check the file " >> check_fs.err #cat check_fs.err | mail -s " Warning ! /opt with $VALUE4%" rbassoi@yahoo.com.br #cat check_fs.err | mail -s " Warning ! /opt with $VALUE4%" mixilo@yahoo.com #cat check_fs.err | mail -s " Warning ! /opt with $VALUE4%" awcogo@alcatel.com.br fi VALUE5=`df -k|grep $FS5|awk '{ print $5 }'|awk -F"%" '{ print $1 }'` if [ $VALUE5 -gt 89 ] then date >> check_fs.err echo " The filesystem $FS5 is at $VALUE5% !!!. Please check the file " >> check_fs.err #cat check_fs.err | mail -s " Warning ! /usr with $VALUE5%" rbassoi@yahoo.com.br #cat check_fs.err | mail -s " Warning ! /usr with $VALUE5%" mixilo@yahoo.com #cat check_fs.err | mail -s " Warning ! /usr with $VALUE5%" awcogo@alcatel.com.br fi VALUE6=`df -k|grep $FS6|awk '{ print $5 }'|awk -F"%" '{ print $1 }'` if [ $VALUE6 -gt 89 ] then date >> check_fs.err echo " The filesystem $FS6 is at $VALUE6% !!!. Please check the file " >> check_fs.err #cat check_fs.err | mail -s " Warning ! /var with $VALUE6%" rbassoi@yahoo.com.br #cat check_fs.err | mail -s " Warning ! /var with $VALUE6%" mixilo@yahoo.com #cat check_fs.err | mail -s " Warning ! /var with $VALUE6%" awcogo@alcatel.com.br fi exit 1