From: Mike Frysinger Date: Thu, 30 Jun 2011 20:54:28 +0000 (-0400) Subject: add helper script for nsupdate X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=4a21f24bd9eddb4a82aa530256657805914866aa;p=home.git add helper script for nsupdate --- diff --git a/.bin/donsupdate b/.bin/donsupdate new file mode 100755 index 0000000..ae7c176 --- /dev/null +++ b/.bin/donsupdate @@ -0,0 +1,25 @@ +#!/bin/sh +[ "$1" = "-u" ] && UPDATE=true || UPDATE=false + +IP=`ip a s dev eth0 | sed -n '/inet 10\./s:.*inet \([^/ ]*\).*:\1:p'` + +doit() { + HOST=$1 + DOMAIN="ad.analog.com" + FQDN="$HOST.$DOMAIN" + + if ${UPDATE} ; then + currip=$(dig +short $FQDN) + [ "${currip}" = "${IP}" ] && return 0 + fi + + cat <<-EOF | nsupdate + server 10.64.53.110 + update delete $FQDN A + update add $FQDN 86400 A $IP + send + EOF +} + +doit vapier-adi +doit vapier