diff options
author | Martin Lucina <martin@lucina.net> | 2011-11-09 18:51:46 +0100 |
---|---|---|
committer | Martin Lucina <martin@lucina.net> | 2011-11-09 18:51:46 +0100 |
commit | ff7caa01f47df249066169daa314664c3669842e (patch) | |
tree | 0b7750d6c7056e191260afe3c90aef4c5c26a313 /nsupdate-script |
Initial commit
Diffstat (limited to 'nsupdate-script')
-rwxr-xr-x | nsupdate-script | 32 |
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 |