Hi,
I would like to create a simple script that will telnet a number of IP and Ports one after the other to confirm connectivity to those addresses.
I thought about changing /etc/services file for telnet port... but there are other machines too which is accessible on telnet standard port.. I thought about changing /etc/services file for telnet port... but there are other machines too which is accessible on telnet standard port..
Any ideas on where to start?
I have looked through the search results and have the following based on an existing script.
This refers to a file "portTest" which looks like this:
139.xxx.xxx.xxx 7001#139.xxx.xxx.xxx 7011#139.xxx.xxx.xxx 2001#
If I echo the variable $i earlier in the script than the telnet command it prints the whole value up to #, but when it sends the telnet request the port is not included.
Any ideas why?
I would like to create a simple script that will telnet a number of IP and Ports one after the other to confirm connectivity to those addresses.
I thought about changing /etc/services file for telnet port... but there are other machines too which is accessible on telnet standard port.. I thought about changing /etc/services file for telnet port... but there are other machines too which is accessible on telnet standard port..
Any ideas on where to start?
I have looked through the search results and have the following based on an existing script.
Code:
#!/bin/sh set -vx read line < portTest OIFS=$IFS IFS=#; for i in $line; do # check for open ports # connTest=`echo " " |telnet "$i"` if [ "`echo $connTest | awk '{ print $3 }` " = "Connected" ] then echo "$connTest port is up" else echo "$connTest port is down" fi done
This refers to a file "portTest" which looks like this:
139.xxx.xxx.xxx 7001#139.xxx.xxx.xxx 7011#139.xxx.xxx.xxx 2001#
If I echo the variable $i earlier in the script than the telnet command it prints the whole value up to #, but when it sends the telnet request the port is not included.
Any ideas why?
No comments:
Post a Comment