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
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
相关文章推荐
- linux调用脚本后如何获得脚本上的输出,ping的使用
- 使用python和批处理bat脚本ping检测主机连通性
- 使用python编写批量ping主机脚本
- linux,使用ping和fping找出网络上的活动主机
- linux下使用脚本判断局域网主机up或者down
- 在nagios中使用python脚本监控linux主机
- 使用Shell脚本对Linux系统和进程资源进行监控
- linux主机使用vnc服务访问服务器图形化桌面
- 使用php作linux自动执行脚本
- 使用RMAN和控制文件备份删除归档日志的SHELL脚本--RED HAT 5 LINUX 64
- 使用Python编写一个在Linux下实现截图分享的脚本的教程
- 使用playbooks来ping主机时显示"Using a SSH password instead of a key is not possible
- 使用 shell 脚本对 Linux 系统和进程资源进行监控
- VMware下配置Linux IP,解决Linux 和主机互ping问题
- 使用SSH客户端远程登录Linux主机(可替代samba、ftp服务)
- 使用SSH客户端远程登录Linux主机(可替代samba、ftp服务)
- 使用脚本获得 消耗Linux操作系统内存的前10个用户
- Linux 使用脚本安装MySQL数据库
- 使用SQL语句创建SQL数据脚本(应对万网主机部分不支持导出备份数据)
- linux下收集系统硬盘,内存使用情况以定时邮件方式发给root的一个脚本