diff --git a/deployment/primary-dnsmanagerd-to-powerdns.sh b/deployment/primary-dnsmanagerd-to-powerdns.sh index f16aa42..cfbe7ba 100755 --- a/deployment/primary-dnsmanagerd-to-powerdns.sh +++ b/deployment/primary-dnsmanagerd-to-powerdns.sh @@ -4,6 +4,11 @@ export PATH=/bin:/sbin:/usr/bin:/usr/sbin # Copying files from the dnsmanagerd bind9 directory to the powerdns directory. PDNSDIR="/var/powerdns/" DNSMANDIR="/tmp/DATA-dnsmanagerd/bind9-zones/" +LOGFILE="/tmp/invalid-domains" + +test_domain_validity() { + named-checkzone $1 $DNSMANDIR/$1 1>/dev/null 2>/dev/null +} local_update() { echo "update domain $1" @@ -20,7 +25,12 @@ action() { echo $event | grep "MOVED_TO" >/dev/null if [ $? -eq 0 ]; then - local_update $file + test_domain_validity $file + if [ $? -eq 0 ]; then + local_update $file + else + echo "invalid domain: $file" >> $LOGFILE + fi fi echo $event | grep "DELETE" >/dev/null