linux下使用mail发送邮件检测存活主机
1.mail配置# uname -ns127_66
# cat /etc/mail/access
# Check the /usr/share/doc/sendmail/README.cf file for a description
# of the format of this file. (search for access_db in that file)
# The /usr/share/doc/sendmail/README.cf is part of the sendmail-doc
# package.
#
# by default we allow relaying from localhost...
Connect:localhost.localdomain RELAY
Connect:localhost RELAY
Connect:127.0.0.1 RELAY
Connect:s127_66 RELAY# service sendmail restart2.检查脚本# cat ping.sh
#!/bin/bash
for ip in 192.168.{100..200}
do
count=`ping -c 1$ip |grep 'received' |awk -F',' '{print $2}'|awk '{print $1}'`
if [ $count -eq 0 ]
then
echo "$ip is down(ping failue)" >/root/host
/bin/mail -s "ping" 563619936@qq.com < /root/host
fi
done
昨天,系花对我笑了一下,乐得我晚上直数羊,一只羊,两只羊,三只羊…… 我真想亲口管你爷爷叫声:爹! 沙发!沙发! 爱——不是想出来的,爱——是做出来的!! 走自己的路,让别人打车去吧。 只有假货是真的,别的都是假的!
页:
[1]