<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
  <title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Hi Eugene,<br>
<br>
Eugene Pefti schreef:
<blockquote cite="mid:023f01c8a564$255b1d20$70115760$@net" type="cite">
  <meta http-equiv="Content-Type" content="text/html; ">
  <meta name="Generator" content="Microsoft Word 12 (filtered medium)">
  <style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";
        color:black;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";
        color:black;}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:Consolas;
        color:black;}
span.EmailStyle19
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.Section1
        {page:Section1;}
-->
  </style>
<!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext="edit">
  <o:idmap v:ext="edit" data="1" />
 </o:shapelayout></xml><![endif]-->
  <div class="Section1">
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: "Calibri","sans-serif"; color: rgb(31, 73, 125);">Hi
Ton,<o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: "Calibri","sans-serif"; color: rgb(31, 73, 125);">This
is almost exactly what I do with shell and utilities. My
script looks like this:<o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: "Calibri","sans-serif"; color: rgb(31, 73, 125);"><o:p> </o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: "Calibri","sans-serif"; color: rgb(31, 73, 125);">#!/bin/bash                                                                    
  <o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: "Calibri","sans-serif"; color: rgb(31, 73, 125);">DNSSERVER=xxx.xxx.xxx.xxx                                                        
  <o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: "Calibri","sans-serif"; color: rgb(31, 73, 125);">DOMAINARRAY=`cat
/dist/importlist`                                             
  <o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: "Calibri","sans-serif"; color: rgb(31, 73, 125);">for
DOMAIN in
$DOMAINARRAY;                                                    
  <o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: "Calibri","sans-serif"; color: rgb(31, 73, 125);">do          
                                                                   <o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: "Calibri","sans-serif"; color: rgb(31, 73, 125);">dig
@$DNSSERVER $DOMAIN AXFR >
/dist/list/$DOMAIN;                             
  <o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: "Calibri","sans-serif"; color: rgb(31, 73, 125);">zone2sql
--zone=/dist/list/$DOMAIN --gmysql --zone-name=$DOMAIN
| mysql -D pdns -u root
                                                             <o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: "Calibri","sans-serif"; color: rgb(31, 73, 125);">done                                                                           
  <o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: "Calibri","sans-serif"; color: rgb(31, 73, 125);">exit
0  <o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: "Calibri","sans-serif"; color: rgb(31, 73, 125);"><o:p> </o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: "Calibri","sans-serif"; color: rgb(31, 73, 125);">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.</span></p>
  </div>
</blockquote>
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. <br>
<blockquote cite="mid:023f01c8a564$255b1d20$70115760$@net" type="cite">
  <div class="Section1">
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: "Calibri","sans-serif"; color: rgb(31, 73, 125);"><o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: "Calibri","sans-serif"; color: rgb(31, 73, 125);"><o:p> </o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: "Calibri","sans-serif"; color: rgb(31, 73, 125);">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?</span></p>
  </div>
</blockquote>
I use it as a standard precaution in case multiple processes are
running the script simultaneously. <br>
<blockquote cite="mid:023f01c8a564$255b1d20$70115760$@net" type="cite">
  <div class="Section1">
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: "Calibri","sans-serif"; color: rgb(31, 73, 125);"><o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: "Calibri","sans-serif"; color: rgb(31, 73, 125);"><o:p> </o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: "Calibri","sans-serif"; color: rgb(31, 73, 125);">Eugene
  <o:p></o:p></span></p>
  <p class="MsoNormal"><span
 style="font-size: 11pt; font-family: "Calibri","sans-serif"; color: rgb(31, 73, 125);"><o:p> </o:p></span></p>
  </div>
</blockquote>
I've been brushing up my skills using sed and came to the following:<br>
dig @$DNSSERVER $DOMAIN AXFR | sed -e '/;/d;/SOA/{h; d;};$g'<br>
<br>
This strips out comments and pastes one SOA record at the end after
deleting all occurrences from the dig-output.<br>
Should you want to keep the comments use the following:<br>
dig @$DNSSERVER $DOMAIN AXFR | sed -e '/SOA/{h; d;};$g'<br>
<br>
Hope this works for you in case Norberts suggestion using ´host´
shouldn´t work.<br>
<br>
Ton
</body>
</html>