sed -i -e "s_^\\($1\\s.*A\\s.*\\s\\)\\([0-9]\\+\\.\\)\\+[0-9]\\+_\\1$3_g" "$2"
}
-function getSerialFromZonefile # <zonefile>
-{
- awk '/; serial/{print$1}' "$1"
-}
-
-function setSerialInZonefile # <zonefile> <serial>
-{
- sed -i -e "s_^\\(.*\\s\\)[0-9]\+\\(\\s\\+; serial.*\\)_\\1$2\\2_g" "$1"
-}
function run()
{
+ touch ${watchfile}
while true; do
inotifywait -q -t 30 -e close_write "${watchfile}" > /dev/null
ret=$?
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
done