Skip to content

Instantly share code, notes, and snippets.

@peppyheppy
Created July 8, 2011 05:47
Show Gist options
  • Save peppyheppy/1071220 to your computer and use it in GitHub Desktop.
Save peppyheppy/1071220 to your computer and use it in GitHub Desktop.
a simple script for updating bind dns serials on multiple zone files
#!/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