#!/bin/sh
# func: watch the disk size and send warning mail
# usage: crontab or while sleep
# note: sendmail service is needed
# send_attachement: uuencode test.txt test | mail -#s "hello,see the attachement" [email protected]<mail.txt
watch_percent=70
to_addr="[email protected] [email protected]"
cc_addr="[email protected]"
show_myaddr="[email protected]/58.222.102.64"
#while sleep 10m
#do
for i in `df -h |sed -n '2,8p'|awk '{print $5}' |sed 's/%//g'`
do
if [ $i -gt $watch_percent ];then
echo $i%
echo "Please check my disk size, It is beyond $watch_percent%." | \
mail -s "[test mail] df_watch:fb79 is $i%" -c $cc_addr $to_addr -- -f $show_myaddr
break
fi
done
#done