Samba/Bind/DHCP/DHCP-dns

Calvin Dodge calvin at dodgeoffice.net
Wed Jan 10 16:57:34 GMT 2001


Ries van Twisk wrote:
> Is there any way I can update the dns database as soon as the 
> DHCP deamon is giving away a IP address?

I use the following script:

#!/bin/sh

firsttime=$(ls -l --full-time /var/state/dhcp/dhcpd.leases)
while [ 1 ];
do

        secondtime=$(ls -l --full-time /var/state/dhcp/dhcpd.leases)
        if [ "$secondtime" != "$firsttime" ];
        then
                /var/dhcp-dns/ddns.cron.pl
                logger DHCP-DNS updated DNS
                firsttime=$secondtime
        fi
        sleep 5
done




You'll want to edit the "/var/dhcp-dns/" and "/var/state/dhcp/" lines to fit your system (yes, I could use variables instead).

The script checks the "dhcpd.leases" file every 5 seconds, which I think should be often enough for you.  If not, then edit the "sleep 5" line to suit your desires.

Calvin




More information about the samba mailing list