I need a script to check if the telnet is available on the server. I have a similar script for Linux but it is not working in HPUX.
Linux script,
telnet `"hostname"` < "dummy.txt" 2>&1 > telnet.txt ### passsing a dummy file ##
grep Escape telnet.txt >> telnet.txt
if [ $? = 0 ]; then
echo "Telnet is available" > telnet.txt
else
echo "Telnet is not available" > telnet.txt
fi
Same script on Hpux
telnet `"hostname"` < "dummy.txt" 2>&1 > telnet.txt ### passsing a dummy file ##
grep Escape telnet.txt >> telnet.txt
if [ $? = 0 ]; then
echo "Telnet is available" > telnet.txt
else
echo "Telnet is not available" > telnet.txt
fi
This command is not getting terminated, see below:
# telnet `"hostname"` < "dummy.txt" 2>&1 > telnet.txt
Telnet TERMINAL-SPEED option ON
That "Telnet TERMINAL-SPEED option ON" stopping the termiantion of the script. Required details captured in telnet.txt
:
# cat telnet.txt
Trying...
Connected to ussltcsnh5001.solutions.glbsnet.com.
Escape character is '^]'.
Local flow control on
HP-UX ussltcsnh5001 B.11.31 U ia64 (ta)
login: