summaryrefslogtreecommitdiff
path: root/nsupdate-script
diff options
context:
space:
mode:
Diffstat (limited to 'nsupdate-script')
-rwxr-xr-xnsupdate-script32
1 files changed, 32 insertions, 0 deletions
diff --git a/nsupdate-script b/nsupdate-script
new file mode 100755
index 0000000..023b161
--- /dev/null
+++ b/nsupdate-script
@@ -0,0 +1,32 @@
+#!/bin/sh
+#
+# nsupdate-script does the actuall call to 'nsupdate'. It is called by the
+# console and returns 'OK' or 'ERROR' to standard output.
+#
+# Edit the address below to point to your DNS server IP.
+#
+DNS_SERVER="192.168.1.11"
+#
+#
+#
+
+if [ $# -ne 2 ]; then
+ echo "usage: nsupdate-script <record> <value>" 1>&2
+ exit 1
+fi
+RECORD=$1
+VALUE=$2
+
+nsupdate -k ./nsupdate.test <<EOT
+server ${DNS_SERVER}
+update delete ${RECORD} TXT
+update add ${RECORD} 10 TXT "${VALUE}"
+send
+EOT
+
+if [ $? -ne 0 ]; then
+ echo "ERROR"
+ exit 1
+fi
+echo "OK"
+exit 0