#!/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.*.**
"
#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 "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 "\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"
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"