free -m |grep ‘^Mem‘ |awk ‘{print $3}‘
free -m |grep ‘Mem‘ |awk ‘{print $2}‘
echo "memory‘s warning `date +%F-%H` memory:$mem_usage%" > $warning_file
fi
if [ -f $warning_file ];then
mail -s "memory warning......" -a $warning_file xinli_2014@163.com < $warning_file
rm -f /tmp/_warning
fi
原文地址:http://blog.51cto.com/13620507/2125274