KSH: Test telnet and exit

Hi,

I need to do a test Telnet in KSH and if the connection is good then disconnect the telnet session with out logging in and without exiting the shell script.

Example output of a good connection:

$telnet xxx.xx.xx.xxx xxxx
Trying xxx.xx.xx.xxx...
Connected to xxx.xx.xx.xxx.
Escape character is '^]'.

This is more to verify that the port is up than anything else. Due to the firewall rules on the destination side I cant just ping and get a valid result; so telnet is the only way of verifying they are up. :frowning:

Any one have any ideas?

Thanks in advance,

Chris

You can use expect command. So when there is a conection it scapes whith the character... And log the results....

Regards..
Exequiel