#! /bin/bash
email_content="/home/imax/monitor/disk_sendmail.pl"
email_logfile="/home/imax/monitor/diskdetail.txt";
#cat /dev/null > ${email_content};
#cat /dev/null > ${email_logfile};
function SendMail()
{
from_name="from@117.78.35.223"
from="117.78.35.225@ubuntu.com"
to="xxx@xxx.com"
email_title="117.78.35.225 磁盘满了,抓紧处理一下!"
email_content="......"
email_subject="disk monitor"
echo -e "`df -h`" | /usr/bin/mail -s "117.78.35.225磁盘已满" -t xxx@xxx.com,xxxxx@xx.com
}
for d in `df -P | grep /dev | awk '{print $5}' | sed 's/%//g'`
do
if [ $d -gt 85 ]; then
df -h >>$email_logfile;
SendMail;
exit 0;
fi
done