#!/usr/bin/perl # # check4xfer -- check primary nameserver for modified data # # Written by Armin Wolfermann. Public Domain. $primary = "insert.your.primary.here"; $testzone = "the.zone.to.check"; $tinydata = "/var/tinydns/root/data"; $transfer = "cd /var/tinydns/root; make"; $lockfile = "/var/run/check4xfer"; die if -e $lockfile; open(LOCK, ">$lockfile"); print LOCK $$; close LOCK; open(DNSQ, "/usr/local/bin/dnsq soa $testzone $primary|"); while() { /^answer: \S+ \d+ SOA \S+ \S+ (\d+)/ && ($modified = $1); } close DNSQ; if($modified ne @{[stat($tinydata)]}[9]) { system($transfer); } unlink $lockfile;