summaryrefslogtreecommitdiff
path: root/nsupdate-script
blob: 023b1613c0c9a4aad4ce1ccdaefa24ac0393f984 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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