zoukankan      html  css  js  c++  java
  • 监控一个服务端口

    监控telnet服务的端口

    #!/bin/bash
    
    # monitor methods
    #1) systemctl service 
    #2) lsof -i :portno
    #3) ps aux | grep PROCESS_NAME
    #### press large 
    #4) Inspect port response  >>recommand
    
    #telnet 
    
    #main
    port_status () {
    temp_file=`mktemp port_status.XXX`
    #1
    [ ! -x /usr/bin/telnet ]&&echo "telnet: not found command"&& exit 1
    #2
    (telnet $1 $2 <<EOF
    quit
    EOF
    ) &>$temp_file
    
    if egrep "^]" $temp_file &>/dev/null;then
      echo "$1 $2 is open"
    else
      echo "$1 $2 is close"
    fi
    rm -rf $temp_file
    }
    
    
    port_status $1 $2
    
    
  • 相关阅读:
    PatentTips
    PatentTips
    PatentTips
    Xvisor ARM32 启动分析
    PatentTips
    PatentTips
    PatentTips
    PatentTips
    PatentTips
    PatentTips
  • 原文地址:https://www.cnblogs.com/persisit/p/13690601.html
Copyright © 2011-2022 走看看