Update DNS ip addresses and update serial number
Update DNS ip addresses and update serial number
This is a script I wrote to update several DNS zones at the same time. This script will update the records to point to the new IP address and also up date the serial number so that any secondary servers will be notified of the update.
#!/bin/bash
LIST=$(echo db.zone{A..C}.com \
db.zone{A..F}.co.uk"
for i in $LIST
do
mv $i $i.old
sed 's/217.102.33.138/205.224.191.52/g' $i.old > $i.2
SERIAL=$(cat $i.old | grep "serial" | awk '{print $1}')
sed "s/$SERIAL/2007040701;/g" $i.2 > $i
rm $i.old
rm $i.2
done;