Fixed variable check and dns error handling in nsupdate script.
This commit is contained in:
parent
b254170d62
commit
f5bd639187
1 changed files with 3 additions and 3 deletions
|
@ -1,7 +1,7 @@
|
|||
#!/bin/sh
|
||||
|
||||
DNSSERVER="<%= dns_nsupdate_server -%>"
|
||||
DNSZONE="<% if defined?(dns_nsupdate_zone) -%><%= dns_nsupdate_zone -%><% end %>"
|
||||
DNSZONE="<% if has_variable?("dns_nsupdate_zone") -%><%= dns_nsupdate_zone -%><% end %>"
|
||||
MYNAME="<%= dns_nsupdate_name -%>"
|
||||
MYKEY="<%= dns_nsupdate_key -%>"
|
||||
|
||||
|
@ -24,7 +24,7 @@ esac
|
|||
|
||||
|
||||
# try to get current addr/name from dns
|
||||
CURADDR=`dig +noall +answer @${DNSSERVER} ${MYNAME} A | awk '{ print $5 }'`
|
||||
CURADDR=`dig +short @${DNSSERVER} ${MYNAME} A 2>/dev/null`
|
||||
if [ $? -ne 0 ]; then
|
||||
# we should get this only in dns errors so exit quietly
|
||||
exit 1
|
||||
|
@ -32,7 +32,7 @@ fi
|
|||
|
||||
|
||||
# exit now if we are up to date
|
||||
if [ ${CURADDR} = ${MYADDR} ]; then
|
||||
if [ "${CURADDR}" = "${MYADDR}" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue