linux 批量ping检测
来源:互联网 发布:爱奇艺点击率换算法 编辑:程序博客网 时间:2024/03/29 16:11
从本地文件中加载ip地址清单,全ip扫描,如果所有ip ping失败多次,执行某个任务:
#! /bin/bash#ping module:testPing ipAddrtestPing(){local ipAddr=$1ping -w 1 -c 2 $ipAddr > /dev/nulllocal result=$?if [ $result -eq 0 ]thenecho "1"elseecho "0"fi}#ip list from local conf#testPing localConftestFromConf(){local localConf="$1"for ipAddr in `cat $localConf`dolocal result=`testPing $ipAddr`if [ $result -eq "1" ]then#echo $ipAddr":true"#ping one addr successecho "1"return#else#echo $ipAddr":false"fidone#all addrs ping failedecho "0";}#ping loop#testPingLoop maxCount conftestPingLoop(){local maxCount=$1local conf=$2for((i=0;i<$maxCount;++i))dolocal result=`testFromConf $conf`if [ $result -eq "1" ]then#some task sucess,exit this ping loopecho "1"return#else#fidone#has retry maxCount,failedecho "0"}taskIfFailed(){echo "need reboot?"}pingTask(){local maxCount=$1local conf=$2while truedolocal result=`testPingLoop $maxCount $conf`if [ $result -eq "1" ]then#if success, sleep some secondsecho "success"sleep 1elsetaskIfFailedfidone}main(){#testPing "127.0.0.1"#testPing "172.1.1.1"#testFromConf "pingtest.txt"pingTask 1 "pingtest.txt"}main
0 0
- linux 批量ping检测
- centos下批量ping检测IP是不是通的
- linux shell 批量mac ping脚本
- linux使用ping批量测试脚本
- linux批量ping域名的脚本
- linux批量ping文件中的ip
- ping检测
- Linux:通过shell批量ping网站、ip延迟
- linux下snort安装和简单ping入侵检测实例
- Linux下用c实现通过ping检测连接
- Linux网络检测相关工具用法(ping/netstat/ss/ethtool)
- 用C/C++代码检测ip能否ping通(配合awk和system可以做到批量检测)
- 批量ping工具
- 批量Ping工具
- 批量ping脚本
- 批量ping脚本
- 批量ping ip地址
- sh脚本:批量ping
- 基站定位LAC,CID转经纬度
- (JVM1)Java内存区域与内存溢出异常之二
- 基于OGG的Oracle与Hadoop集群准实时同步介绍
- WinRAR去广告心得
- leetcode 111. Minimum Depth of Binary Tree
- linux 批量ping检测
- linux目录权限修改(以及umask用法)
- 排序总结----希尔排序
- Ubuntu(Linux)下Matlab R2016b重编译并配置vlfeat0.9.20
- TortoiseSVN 连接资源库时 opration in progerss
- 使用Notepad2替代系统笔记本
- 资料验证及回呼
- CRF(condition random field)
- 我的Unity(15)一点一滴 使用GetComponentsInChildren遇到的问题