Created
July 8, 2011 05:47
-
-
Save peppyheppy/1071220 to your computer and use it in GitHub Desktop.
a simple script for updating bind dns serials on multiple zone files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
mkdir backup | |
for file in $(ls /var/named/*.db); | |
do | |
if [ -f $file ]; | |
then | |
cp $file backup/ | |
serial=`date +%Y%m%d%H` | |
OLD=`egrep -ho "2010[0-9]*" $file` | |
NEW=$(($OLD + 1)) | |
sed -i "s/$OLD/$NEW/g" $file | |
sed -i "s/209.20.66.227/67.207.134.28/g" $file | |
echo "fixed $file" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment