zoukankan      html  css  js  c++  java
  • shell脚本实现telnet测试服务端口

    备注,使用方法:当前目录下要存在需要测试的地址端口,例子:
    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 " " | 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

  • 相关阅读:
    pymsql及事务
    MySQL表的操作
    MySQL操作
    epoll、mysql概念及简单操作
    IO模型
    面向对象4
    面向对象3
    面向对象2
    练习——网络编程2
    练习——网络编程
  • 原文地址:https://www.cnblogs.com/zjpeng/p/11360674.html
Copyright © 2011-2022 走看看