Chinaunix首页 | 论坛 | 博客
  • 博客访问: 339607
  • 博文数量: 105
  • 博客积分: 358
  • 博客等级: 一等列兵
  • 技术积分: 444
  • 用 户 组: 普通用户
  • 注册时间: 2011-06-25 23:00
个人简介

爱生活,爱养生 www.sijiyang.com 欢迎朋友来友联

文章分类

全部博文(105)

文章存档

2017年(2)

2016年(2)

2014年(24)

2013年(34)

2012年(39)

2011年(4)

分类: LINUX

2012-01-01 10:49:41

#!/bin/bash
#作者:罗红江
#QQ:123769752
#mail:g_linux@qq.com
#原创---请你转载说明出处,请支持别人的劳动成果。
clear
declare -i count sum mf
sum=0
IP="
134.235.*.**
134.235.*.**
134.235.*.**
134.235.*.**
134.235.*.**
134.235.*.**
134.235.*.**
"
if (( $# == 0 ));then   #?ì2éê?è?μ?2?êy,ê?2?ê??yè·μ??£
 echo "Format: $0 [command]"
   exit
fi

echo -e "\E[23;33m"
echo  "=================================start ..============================= "
echo -e "\E[0m"
echo -e "-----------------------------------------------------------------------                                                                             -----------------------------------------------\n"
for i in ${IP[*]}
do
    count=$count+1
   
    ping  -t 3ms -c 1 $i 2>&1>/dev/null
if (( $?>0 ));then
    echo -e "\E[31m  $remoteIP connect fail!  <<================================                                                                             ==========\n \E[0m"
    badmachine=$remoteIP,$badmachine
    continue
else
    #echo -e "\E[32m $remoteIP             proc >>>>>>>>>>>>>>>>>>>>>>>>>>>>>[in                                                                             g]\n \E[0m"
      ssh  $remoteIP $@
      if (( $? > 0 ));then
                  echo -e "\E[31m !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! \E[0m"
                  echo "$i is proc Error!"
                  badmachine=$remoteIP,$badmachine
                  echo -e "\E[31m !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! \E[0m"
        else
                                sum=$sum+1
         echo -e "\E[32m $remoteIP             proc >>>>>>>>>>>>>>>>>>>>>>>>[ok]                                                                             \n \E[0m"
            fi
    echo -e "-------------------------------------------------------------------                                                                             ---------------------------------------------------\n"
fi
done
mf=$count-$sum
echo -e "\E[23;33m"
echo "================================END ..============================= "
echo  -e "\E[0m"
echo -e "machine:[$count]--make success:[$sum],make fail:\E[31m [$mf]\E[0m"
echo -e "bad macheine IP: $badmachine \n"
阅读(826) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~