Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

monitor telnet

Status
Not open for further replies.

icu812

MIS
Sep 10, 2001
52
0
0
US
I have a system (SP node) that I cannot telnet to at times. I can ping it but I cannot telnet to it. I need to write a korn shell srcipt that will alert me when users cannot telnet to this machine. I currently have the following:
#!/bin/ksh
host=sp18
telnet $host 1>/tmp/telnet.out 2>&1
foo=`grep respond /tmp/telnet.out`
if [ "$?" -eq "0" ] ; then
echo "Host $host does not respond"
fi

when the system is up and running and telnet is working fine, the script hangs. Can someone please help me get over this problem? Thanks alot
 
Hi,
The script appears to hang as it is waiting for a login to be entererd. To overcome this modify the telnet as follows:

telnet $host 1>/tmp/telnet.out 2>&1 <<EOF
^]
quit
EOF


The ^] enters telnet subcommand mode, in which a quit can be entered (to enter ^] press Ctrl+v, Ctrl+]).

Hope this does the trick.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top