LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   nslookup (https://www.linuxquestions.org/questions/linux-newbie-8/nslookup-4175524430/)

shruti_vip 11-05-2014 07:38 AM

nslookup
 
Hi,

My requirement is from shell script I have to check whether nslookup is working or not.
For that I have written code like:

echo "Nslookup Start" >> /var/tmp/custominfo
if nslookup -type=AAAA vm1.vimfvt.com > /dev/null
then
echo "forwardlookup successful" >> /var/tmp/custominfo
else
echo "forwardlookup failed" >> /var/tmp/custominfo
fi
if nslookup -type=AAAA 2001:192:168:1::13 > /dev/null
then
echo "reverselookup successful" >> /var/tmp/custominfo
else
echo "reverselookup failed" >> /var/tmp/custominfo
fi
echo "Nslookup End" >> /var/tmp/custominfo

But most of the time it hangs and I only get output as Nslookup Start

Please let me know is there any other way where I can set some timeout to check if nsllokup is working or not.

Any help will be appreciated.

Thanks

smallpond 11-05-2014 09:16 AM

dig lets you set a timeout on queries and a limit on the number of retries.


All times are GMT -5. The time now is 04:57 AM.