From 4a21f24bd9eddb4a82aa530256657805914866aa Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Thu, 30 Jun 2011 16:54:28 -0400 Subject: [PATCH] add helper script for nsupdate --- .bin/donsupdate | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100755 .bin/donsupdate 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 -- 2.39.5