X-Git-Url: https://git.sthu.org/?p=shutils.git;a=blobdiff_plain;f=nsd%2Fnsd-dynipwatch;h=068702bbffd133a27dc9dde6f7b350ecca317eb7;hp=4a650b0eaf4ec7a5f3b2fa4e63f1a4513180c2ec;hb=68e246948776c9bca12913cd3cf648fc783191f9;hpb=27141037ab53a7cc3cdad48448eb609323ff5800 diff --git a/nsd/nsd-dynipwatch b/nsd/nsd-dynipwatch index 4a650b0..068702b 100755 --- a/nsd/nsd-dynipwatch +++ b/nsd/nsd-dynipwatch @@ -36,15 +36,6 @@ function setAddrInZonefile # sed -i -e "s_^\\($1\\s.*A\\s.*\\s\\)\\([0-9]\\+\\.\\)\\+[0-9]\\+_\\1$3_g" "$2" } -function getSerialFromZonefile # -{ - awk '/; serial/{print$1}' "$1" -} - -function setSerialInZonefile # -{ - sed -i -e "s_^\\(.*\\s\\)[0-9]\+\\(\\s\\+; serial.*\\)_\\1$2\\2_g" "$1" -} function run() { @@ -64,11 +55,10 @@ function run() fi if ! [ "${oldip}" = "${newip}" ]; then - serial=`getSerialFromZonefile "${zonefile}"` - serial=$(( $serial + 1)) - echo " Update IP address. New serial ${serial}." + echo " Update IP address. Increment serial." setAddrInZonefile "${host}" "${zonefile}" "${newip}" - setSerialInZonefile "${zonefile}" "${serial}" + nsd-incrserial "${zonefile}" + /etc/nsd3/signzone.sh sthu.org nsdc rebuild && nsdc reload && nsdc notify fi