Blob Blame History Raw

# Paul Wouters <>
# 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. If 1 zone is newer,
# we need to rebuild the db file.
# This might give problems with huge zones, eg TLD's, which cannot
# complete this operation within an hour, but it should work fine for
# most other uses.

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

# 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