Blob Blame History Raw
#!/bin/sh

# Paul Wouters <paul@xelerance.com>
# This folds back zone updates, dynamic updates, etc that nsd records
# in the ixfr.db and nsd.db files back into the zone files or visa
# versa

# Ideally check if ixfr.db newer then any zones, only then do
/usr/sbin/nsdc patch > /dev/nul 2>%1

# We try to only rebuild/reload when neccessary
# every hour. But for hosting a lot of small zones, it is useful.

for zonefile in `/usr/sbin/nsd-checkconf -v /etc/nsd/nsd.conf  |grep zonefile: | sed "s/^.*\"\(.*\)\"/\1/"`
do
	if [ $zonefile -nt /etc/nsd/nsd.db ]
	then
		echo "Zone $zonefile update requires nsd.db rebuild"
		/usr/sbin/nsdc rebuild > /dev/nul 2>%1
		/usr/sbin/nsdc reload > /dev/nul 2>%1
		break
	fi
done


# nsd checks the serial in notify requests, so its better to send an
# occasional redundant notify, then to miss it.
# According to the nsd team, this is no longer neccessary
# /usr/sbin/nsdc notify > /dev/nul 2>%1