Operating System - HP-UX
1753850 Members
7597 Online
108807 Solutions
New Discussion юеВ

Re: telnet xx.xx.xx port, how break the connection in script?

 
SOLVED
Go to solution
Michael Steele_2
Honored Contributor

Re: telnet xx.xx.xx port, how break the connection in script?

 
Support Fatherhood - Stop Family Law

Re: telnet xx.xx.xx port, how break the connection in script?

Hello,

In ksh you might try :

# Send a ^] to telnet in background
# ---------------------------------
print "\035" | telnet 10.xx.xx.xx 80 > temp_file &

# Wait long enough
# ----------------
sleep 1

# Kill the background process
# in case there is no answer
# ---------------------------
kill -KILL $!

# Examine the generated temporary file
# Be careful the -q option is not
# portable, I assume you're on HP-UX
# ------------------------------------
if egrep -q Connected temp_file ; then
message="It's fine"
else
message="Port 80 is down!""
fi

print $message

Cheers,

Jean-Philippe
bullz
Super Advisor

Re: telnet xx.xx.xx port, how break the connection in script?

Thanx all