Unix Shell - checking service through telnet.

This is Interesting: Free IT Magazines  
Home > Archive > Unix Shell > November 2006 > checking service through telnet.





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author checking service through telnet.
kiranmn@my-deja.com

2006-11-25, 7:21 am

Hi,

Following script i am using to check DNS services on multiple
machines, this script is stopping at
first successful connection. tt.txt contains ip and
hostname(ip;hostname). Please help.

========================================
=
cat tt.txt | while read xyz
do
x1=`echo "$xyz" | awk -F";" '{print $1}'`;
x2=`echo "$xyz" | awk -F";" '{print $2}'`;
echo "IP=$x1";
echo "HOST=$x2";
temp=`telnet $x1 53`;
echo $temp > al.tt;
grep "Escape" al.tt
if [ $? -eq 0 ] ; then
echo "--$x1---------OK";
else
echo "--$x1-----NOT OK";
fi
echo "=============== ";
done
echo "Ended";
=============================

Michael Heiming

2006-11-25, 7:21 am

In comp.unix.shell kiranmn@my-deja.com:
> Hi,


> Following script i am using to check DNS services on multiple
> machines, this script is stopping at
> first successful connection. tt.txt contains ip and
> hostname(ip;hostname). Please help.

[..]
> temp=`telnet $x1 53`;


Though DNS should work through tcp there is no guarantee a server
will respond to tcp queries, default is to use udp.

I'd strongly suggest to use something like 'nc' (netcat) for the
task, this should certainly ease up things. See 'man nc' once you
have it installed, if it isn't.

Good luck

--
Michael Heiming (X-PGP-Sig > GPG-Key ID: EDD27B94)
mail: echo zvpunry@urvzvat.qr | PERL -pe 'y/a-z/n-za-m/'
#bofh excuse 76: Unoptimized hard drive
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com