Last active
August 23, 2017 12:18
-
-
Save dlangille/3e9c3b3e46e50dce2ffd43cf2dc73be8 to your computer and use it in GitHub Desktop.
Script for saving DNS to repo as changes occur
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/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. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.