Search Again:

Re: Searching out domains that I forgot to tell to slave.

From: Scott Haneda
Date: Tuesday, December 16, 2003
Time: 7:37:01 pm

on 12/16/2003 12:49 PM, Men & Mice Support at cbuxton@menandmice.com wrote:

> Of course, with just a little more effort, you could create a
> full-blown shell script that would iterate through zone names stored
> in a text file, check them all, and display the names of ones that
> have problems.

Thanks Chris, I took the time to make my first bash script, it seems to do
what I want, if this is of help to others, feel free to use it:

Usage is scriptname /path/to/domains Nameserver
/path/to/domains should be a return separated list.

You can chmod +x it and put it in ~/bin if that is in your path, otherwise,
call it out as normal...

#!/bin/bash

# Script to test if a list of domains is being slaved
# Usage is scriptname /path/to/domains server
if [ "$1" = "" ]; then
echo "You need to give a path to a return seperated domains file"
echo " Usage is scriptname /path/to/domains server"
exit 0
fi

if [ "$2" = "" ]; then
echo "Please supply a DNS server"
echo " Usage is scriptname /path/to/domains server"
exit 0
fi

echo "The following domains need to be slaved by $2"
DOMAINS=`cat "$1"`
for domain in $DOMAINS
do
result=`dig soa +norecurse @"$2" $domain | grep flags:.*\ aa\ `
if [ "$result" = "" ]; then
echo $domain
fi
done
exit 0

--
-------------------------------------------------------------
Scott Haneda Tel: 415.898.2602
http://www.newgeo.com Fax: 313.557.5052
scott@newgeo.com Novato, CA U.S.A.




Messages In This Thread:



Return to Digital Point Solutions' Home Page