1
2 #!/bin/bash
3
4 #This shell is used to test the network
5 export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/usr/local/mysql/bin:/root/bin:
6 #dingyi cheng gong ping tong de dizhi
7 s=0
8 #dingyi shi bai ping tong de dizhi
9 f=0
10 #ding yi xu yao ping de IP dizhi
11 IPADDR="10.216.254"
12 #shijian
13 Date=`date +%F`
14 cat <
15 ---------------------Date 2014.12.5-----------------------------
16 -------------The scipt is used to test the network--------------
17 -----------The test is running,please wait a moment!------------
18 help
19 for I in {30..40};do
20 ping -c 1 -w 2 ${IPADDR}.${I} >/tmp/ping
21 if [ $? == 0 ];then
22 {
23 echo "${IPADDR}.${I} connect success!:${Date}" >>/tmp/tongji
24 s=$[s+1]
25 }
26
27 else
28 {
29 echo "${IPADDR}.${I} connect failure!:${Date}" >>/tmp/tongji
30 f=$[f+1]
31 }
32 fi
33 done
34 echo "The number of success connect is $s !"
35 echo "The number of failure connect is $f !"
阅读(270) | 评论(0) | 转发(0) |