Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
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.
Owner

dlangille commented Aug 19, 2017

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