Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

/etc/hosts DNS comparison

Status
Not open for further replies.

jaggerd

MIS
Apr 11, 2006
10
US
Hey All

I've been tasked with creating an automated update between our 2 print servers. What they are doing is using AIX 5.2ML6 570 servers with the EasySW CUPS application and /etc/hosts to add the printers, and they are wanting me to dump the hosts file to another file, run it against the DNS, which is on it's own server, parse out the printers that are not in the DNS and flag those for either addition to the DNS manually or automatically. Any ideas on how to do this or even start? I don't have the DNS/BIND book, yet.

Any help with this would be greatly appreciated.

 
I have tried this statement below, but it sticks at the nslookup prompt.

for i in `cat /etc/hosts |awk '{print $1}'`; do
> nslookup $1 > /home/sysdpj/nstest
> done
 
for i in `awk '!/^#/{print $1}' /etc/hosts`; do

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
That's "[tt]$i[/tt]", not "[tt]$1[/tt]". Try...
Code:
for i in `awk '{print $1}' /etc/hosts`
do
   nslookup $i >> /home/sysdpj/nstest
done
You should add something to skip comments and blank lines in the hosts file too.
 
Sam
Thanks I caught that after I posted it, not enough coffee so far this morning I guess.

Thanks, these both helped.
I'm off to parsing out the data to see which of the entries that are not in the nstest that are in the /etc/hosts file. Compile a list and give it back to me. :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top