Bind

Script for updating my slave nameservers

#!/bin/sh

cd /etc
for file in named-*.conf
do
   makeslaveconf.pl -a 192.168.1.100 $file > /tmp/$file
done
   rsync -av /tmp/named-*.conf slave-nameserver.example.com:/etc/

makesalveconf.pl (modified from the DNS&BIND Cookbook) [WWW] http://examples.oreilly.com/dnsbindckbk/makeslaveconf.pl

#!/usr/bin/perl -wap

use Getopt::Std;

BEGIN {
        getopt("a");
        $master = $opt_a;
        die "Usage:  $0 -a <master's addr> <conf file>\n" unless $master && (@AR
GV == 1);
}

if (/type\s+master/) {
        $whitespace = substr($_, 0, index($_, "type"));
        s/master/slave/;
        #print;
        print $whitespace, "masters { ", $master, "; };\n"; 
        next LINE;
}


if (/allow-update/) {
        s/.*\n//;
        next LINE;
}

s/db/bak/ if /^\s*file/;

last edited 2006-06-27 02:03:24 by MichaelBest