There is a bug in the dnsmasq-lease-sync.sh script published in the following page:
the last line:
mv /tmp/dhcp_lease_new /tmp/dhcp.leases
replaces the file, but dnsmasq then fails to update new leases because apparently it maintains an open handle on the deleted file
the solution is to overwrite the file content (which maintains the same file handle, so that dnsmasq continues to update it) as follows:
cat /tmp/dhcp_lease_new > /tmp/dhcp.leases
rm /tmp/dhcp_lease_new
As an improvement on the above script I wrote the following that supports multiple dhcp instances that are necessary in case we have more subnets:
#!/bin/sh
# SYNCS contents of dnsmasq dhcp leases
OTHER_ROUTER=my-other-router
BASE_LEASES="/var/dhcp/*"
LEASES=$(echo ${BASE_LEASES})
for i in ${LEASES}; do
NET_LEASE=$(basename $i)
#echo ${NET_LEASE}
scp -q root@${OTHER_ROUTER}:$i /tmp/${NET_LEASE}.${OTHER_ROUTER}
cat /tmp/${NET_LEASE}.${OTHER_ROUTER} $i | sort -u > /tmp/${NET_LEASE}.new
cat /tmp/${NET_LEASE}.new > $i
rm -f /tmp/${NET_LEASE}.*
done