[TriLUG] OT - Connectivity Test?

James Olin Oden james.oden at gmail.com
Thu May 3 10:30:27 EDT 2007


On 5/3/07, Howard Boyd <boydh at us.ibm.com> wrote:
> I would like to create a script (preferably Korn Shell) that will test
> connectivity between two Unix (AIX) servers. Ping isn't an option for me
> as one of the servers is in a DMZ and PING requests aren't allowed through
> the firewalls. The backend system is running an HTTP server. Can someone
> provide a command that I can use to test connectivity between the two
> servers? Thanks,
>
This little perl script will do it:

   #!/usr/bin/perl
   use IO::Socket;
   my $sock = new IO::Socket::INET (
       PeerAddr => $ARGV[0],
       PeerPort => $ARGV[1] || '80',
       Proto    => 'tcp',
   );
   exit(ref($sock) ? 0 : 1);

You call it like:

   nameOfScript (host) [(port)]

I have it defaulting to 80 which is http.   You can learn more at:

   http://www.perlfect.com/articles/sockets.shtml

Good Luck...james

   name

> Howard
>
> **************************************************************
> * Then I realized that it is good and proper for a man to
> * eat and drink, and to find satisfaction in his toilsome
> * labor under the sun during the few days of life God has
> * given him - for this is his lot. Moreover, when God gives
> * any man wealth and possessions, and enables him to
> * enjoy them, to accept his lot and be happy in his work -
> * this is a gift of God. Ecclesiastes 5:18-19 NIV
> **************************************************************
> --
> TriLUG mailing list        : http://www.trilug.org/mailman/listinfo/trilug
> TriLUG Organizational FAQ  : http://trilug.org/faq/
> TriLUG Member Services FAQ : http://members.trilug.org/services_faq/
>



More information about the TriLUG mailing list