I am trying to see if a port is opened for a list of hostnames/IP's, and I used a simple script like this one to ssh to each host and capture the output.
for i in `cat $1`
do ssh $i "sleep 5 | telnet 11.22.33.44 123"
done
This is throwing a "No environment-specific terminal time" error because Telnet is designed to be an interactive tool to interact with a smart terminal.
How can I go around this, knowing that I cannot use nc
command as it's not available on Unix AIX systems?
Please note that some hosts will reply with Connected to 11.22.33.44. Escape character is ^]
and that means there is connectivity while others will freeze at Trying ...
meaning that there is no connection.