I have a list of DNS servers I need to look up information on. Each of these servers has a master and a slave database. Essentially what I need to do is create two text files for each server. One with the Master view and one with the Slave view. There's 20 servers, in the end I should have 40 text files.
Below is what I'm running.
#!/bin/bash
# Script is responsible for determining which zones are in which view across the DNS platform.
#references text file that contains dns server names
for i in $(cat ddns); do
#list all zones in ddns in the master db
echo "ans_listzones channel=$i master"
#list all zones in ddns in the slave db
echo "ans_listzones channel=$i slave"
done
The site name (site1-ddns01) is dictated by the input file.
---------- Post updated 07-17-12 at 10:10 AM ---------- Previous update was 07-16-12 at 05:38 PM ----------
I figured it out. Here's what I did...
#!/bin/bash
# Name: DNS Master Slave Zone Dump
# Purpose: Script is responsible for determining which zones are in which view across the DNS platform.
#References text file that contains server names
while read i; do
#Creates text file named after server
echo "Master" > $i.txt
#list all zones in dns in the master db and outputs to text file
echo "ans_listzones channel=$i master >> $i.txt"
#creates seperation within the file for the slave zones
echo "Slave" >> $i.txt
#list all zones in dns in the slave db outputs to text file
echo "ans_listzones channel=$i slave >> $i.txt"
#ends scirpt and directs input file
done < dns