备注,使用方法:当前目录下要存在需要测试的地址端口,例子:
cat ip.txt
141.12.65.17 7500

#!/bin/bash
cur_dir=$(pwd)
ipfile=$cur_dir/ip.txt
logfile=$cur_dir/log.txt
date=date
echo "****${date}" >> $logfile
if [ ! -f "$ipfile" ]; then
echo "系统检查到在当前路径下不存在要测试的地址清单,请补充ip.txt要测试的地址清单 EXIT"
exit
fi
if [ ! -f "$logfile" ]; then
touch $cur_dir/log.txt 
fi
cat $ipfile | while read line
do
result=echo -e "\n" | telnet $line 2> /dev/null | grep Connected | wc -l
if [ $result -eq 1 ]; then
echo " $line network is nomral" >> $logfile
else
echo " $line network is warried" >> $logfile
fi
done

相关文章:

  • 2022-02-07
  • 2022-12-23
  • 2022-02-10
  • 2022-12-23
  • 2021-12-09
  • 2021-11-20
  • 2021-06-08
  • 2021-12-28
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-27
  • 2021-04-16
  • 2022-02-06
相关资源
相似解决方案