您的位置:首页 > 运维架构 > Linux

Linux下使用脚本ping一批主机

2014-01-20 20:44 381 查看
Linux Platform: CentOS 6.5

please refer /article/4212789.html to send mail via outside ISP

1. vi /tmp/ping.sh
#!/bin/bash
for address in `cat /tmp/ip.txt`
do
ping -c 3 $address
echo;echo
done

vi /tmp/ip.txt
192.168.1.1
192.168.1.100

vi /tmp/result.sh
/tmp/ping.sh > /tmp/ping-result.txt
echo "ping test result" | mail -s "ping test result" -a /tmp/ping-result.txt 133xxxxxxxx@189.cn

chmod +x /tmp/ping.sh /tmp/result.sh

You can add to crontab to send your mail periodically.

本文出自 “Ilovecat(个人笔记)” 博客,请务必保留此出处http://hj192837.blog.51cto.com/655995/1353259
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: