新公司第二天写的,需要用到sendEmail.
#wget http://caspian.dotconf.net/menu/Software/SendEmail/sendEmail-v1.56.tar.gz
#tar zxvf sendEmail-v1.56.tar.gz
#cd sendEmail-v1.56.tar.gz
#cp sendEmail /usr/local/bin
#chmod +x /usr/local/bin/sendEmail
脚本如下
#!/bin/bash
size=`df -h |grep "/$"|awk '{print $4}' |cut -f 1 -d %`
if [ "$size" -lt "75" ];then
echo "disk space / is below 75%"
else
echo "disk space / is over 75%"
sendEmail -f xxxx@163.com -t xxxx@139.com -s mail.163.com -u "disk space warning" -m "disk space / is over 75%" -xu xxx -xp xxxx
fi
转载于:https://blog.51cto.com/annirg/685450