Networking
cancel
Showing results for 
Search instead for 
Did you mean: 

HP-UX telnet command is not getting termianted while redirecting the content

 
Highlighted
Occasional Visitor

HP-UX telnet command is not getting termianted while redirecting the content

Hi All,

I am preparing a script to check if telnet connectivity is available on the server. Scrit works fine for other OS(Redhat linux and Solaris).

I'm trying to get the output(banner message) to a file and I will check for a keyword "Escape" if the word exists then telnet is enabled and if not is is disabled.

command is 

 telnet `"hostname"` < "dummy.txt" 2>&1 > telnet.txt 

Output is getting redirected to telnet.txt but the command is not getting terminted , it stops like below,

# telnet `"hostname"` < "dummy.txt" 2>&1 > telnet.txt
Telnet TERMINAL-SPEED option ON

 then I need to open an another session to kill it..

But I'm getting required output in telnet.txt (word "Escape")

 

# telnet `"hostname"` < "dummy.txt" 2>&1 > telnet.txt
Telnet TERMINAL-SPEED option ON
Killed
# 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:

Kindly help me to get this resolved.

-Antony

 

1 REPLY 1
Highlighted
Acclaimed Contributor

Re: HP-UX telnet command is not getting termianted while redirecting the content

What's in dummy.txt?  Do you have "quit" in it?

Or perhaps: ~.

to close the connection.