Skip to content

Instantly share code, notes, and snippets.

@mdunham
Created October 6, 2017 20:40
Show Gist options
  • Save mdunham/772534a492e0d5b178694fb4d1fc09a3 to your computer and use it in GitHub Desktop.
Save mdunham/772534a492e0d5b178694fb4d1fc09a3 to your computer and use it in GitHub Desktop.
Mass update all DNS zones and set new serial using find and replace
# Backup
cp -rpf /var/named /var/named.backup
# Find and Replace
replace "find_something" "replace_with" -- /var/named/*.db
# Generate New Serial
grep "serial, todays" /var/named/*.db | sed "s/://g" | cut -d/ -f4 | awk {'system("replace "$2" "strftime("%Y%m%d")"00 -- /var/named/"$1)'}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment