#!/bin/bash
# The monitoring host survival script.
# Writen by Wangxiaoqiang 2014-11-24.
HOST=xxx.xxx.x.xx
MAIL=xxxxxxxxxxx@xxx.com
while true
do
ping -c 10 $HOST > /dev/null
if [ $? -ne 0 ]
then
echo "HOST:$HOST down." | mail -s "MAIL FOR $HOSTNAME" $MAIL
fi
sleep 30
done
# End
## sh mail.sh & , 可以将其放入 /etc/rc.local 文件中
脚本练习_每 30s 监控主机存活率 邮件报警
最新推荐文章于 2021-07-31 17:01:02 发布