Skip to content

Instantly share code, notes, and snippets.

@dlangille
Last active August 23, 2017 12:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dlangille/3e9c3b3e46e50dce2ffd43cf2dc73be8 to your computer and use it in GitHub Desktop.
Save dlangille/3e9c3b3e46e50dce2ffd43cf2dc73be8 to your computer and use it in GitHub Desktop.
Script for saving DNS to repo as changes occur
#!/bin/sh
MYNAME="dns-notify"
ZONE=$1
SERIAL=$2
MASTER=$3
SVN_SSH="/usr/bin/ssh -qi /usr/home/dan/.ssh/mydev-public-dns-updates"
export SVN_SSH
DIG="/usr/local/bin/dig"
LOGGER="/usr/bin/logger"
SVN="/usr/local/bin/svn"
ZONE_FILE_DIR="/usr/home/dan/dns-public-BRANCH"
${LOGGER} -t ${MYNAME} has been invoked with zone=\'$ZONE\', serial=\'$SERIAL\', and master=\'$MASTER\'.
cd ${ZONE_FILE_DIR}
${DIG} +noall +answer +onesoa +rrcomments @${MASTER} ${ZONE} axfr > ${ZONE}.db
${SVN} ci -m "serial ${SERIAL}" ${ZONE}.db
${LOGGER} -t ${MYNAME} $ZONE with serial ${SERIAL} has been saved.
@dlangille
Copy link
Author

Used with https://www.dotat.at/prog/nsnotifyd/

From the man nsnotifyd page, this script is the command which is run whenever a notify is received.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment