Hi Eugene,

Eugene Pefti schreef:

Hi Ton,

This is almost exactly what I do with shell and utilities. My script looks like this:

 

#!/bin/bash                                                                    

DNSSERVER=xxx.xxx.xxx.xxx                                                        

DOMAINARRAY=`cat /dist/importlist`                                             

for DOMAIN in $DOMAINARRAY;                                                    

do                                                                              

dig @$DNSSERVER $DOMAIN AXFR > /dist/list/$DOMAIN;                             

zone2sql --zone=/dist/list/$DOMAIN --gmysql --zone-name=$DOMAIN | mysql -D pdns -u root                                                              

done                                                                           

exit 0 

 

The problem is inherent to zone2sql. Like Bert mentioned AXFR ends its output with one more SOA RR. I hoped that zone2sql takes care about this duplicate but in vain.

I see the problem in the output of zone2sql. Just to be clear I only use pdns and have no scripts running to grab data using AXFR.

 

May I ask you a question, Ton? Why do you append the process ID to the zone file in your script? Just to make it more verbose?

I use it as a standard precaution in case multiple processes are running the script simultaneously.

 

Eugene

 

I've been brushing up my skills using sed and came to the following:
dig @$DNSSERVER $DOMAIN AXFR | sed -e '/;/d;/SOA/{h; d;};$g'

This strips out comments and pastes one SOA record at the end after deleting all occurrences from the dig-output.
Should you want to keep the comments use the following:
dig @$DNSSERVER $DOMAIN AXFR | sed -e '/SOA/{h; d;};$g'

Hope this works for you in case Norberts suggestion using ´host´ shouldn´t work.

Ton
_______________________________________________
Pdns-users mailing list
[email protected]
http://mailman.powerdns.com/mailman/listinfo/pdns-users

Reply via email to