#!/bin/sh
# This script is executed often (every 10 minutes) from cron
# and update the DNS using /var/run/dhcpd-ip.log
# This file is produced by a modified dhcp server
# DHCPD-BETA-5.16. The diff is available at ftp.solucorp.qc.ca
# in pub/linuxconf/devel/dhcpd.diff

YOURDOMAIN=
LOG=/var/run/dhcpd-ip.log
process(){
	while read name ip
	do
		/sbin/dnsconf --setfromip $name.$YOURDOMAIN $ip
	done
}
if [ -f $LOG ] ; then
	mv $LOG $LOG.tmp
	# make sure the dhcpd daemon has finished updating it
	# it is opening/closing the file for each transaction
	sleep 5
	process <$LOG.tmp
	rm -f $LOG.tmp
	/usr/sbin/named.reload
fi