发邮件命令


[root@localhost testdir]# cat mail.sh
a=`free -m | awk '/-\/\+/ {print $NF}'`
if [ $a -lt 4000 ]
   then
      echo "Current mem is $a" | mail -s "title" 2224507221@qq.com
fi
[root@localhost testdir]#

 这里邮件很可能发不出去。

Mar 11 21:50:45 localhost postfix/smtp[23477]: 6218D67F1C: to=<2224507221@qq.com>, relay=mx3.qq.com[113.108.18.210]:25, delay=2.3, delays=0.03/0.01/2.1/0.13, dsn=5.0.0, status=bounced (host mx3.qq.com[113.108.18.210] said: 550 Mail content denied. http://service.mail.qq.com/cgi-bin/help?subtype=1&&id=20022&&no=1000726 (in reply to end of DATA command))

 原因是由于QQ邮箱认为这个动作是在发大量垃圾邮件,直接拒绝了。


#monition free
*/3 * * * * /bin/sh /testdir/mail.sh >/dev/null 2>&1