Search

Tuesday, August 19, 2008

Space check and send the mail if space greater than 90%

Below script is used to check the space on server, If space is greater than 90%, it sends the mail to admin.
==============Start script================
#!/bin/tcsh

set a=`df -h /PATH | head -13 | tail -1 | awk '{print $4}' | cut -c 1`
set b=`df -h /PATH | head -13 | tail -1 | awk '{print $4}' | cut -c 2`
set c=`echo $a$b`

if ( "$c" > 90 ) then

mail -s "Space problem in server" myemail@yahoo.com << EOF
Space in server is now $c%.
EOF
else
echo Everything looks fine.
endif

=================================

No comments: