[Pdns-users] Don't set the SOA serial to 0 when using Generic MySQL
Ben Kennedy
ben at zygoat.ca
Thu Aug 12 16:51:09 UTC 2004
On 12 8 2004 at 7:19 am -0400, Simon Østengaard wrote:
>It seems that I have to set the SOA serial manually for all my zones if I
>want to use the gmysql backend. Is there no solution for autocalculating
>these serial number for this backend?
I have come to the same conclusion. I just run a perl script now
whenever I make changes to a few things that does something like this:
# Update the SOA records to reflect the current time in serial number.
# Has to be YYYYMMDDNN format due to legacy constraints
@a = localtime($time);
$soatime = sprintf("%04d%02d%02d%02d", $a[5]+1900, $a[4]+1, $a[3],
($a[2]*60+$a[1])*100/(1440));
do_pdns_query "UPDATE records SET content='$ZADM{PRIMARYHOSTNAME}
support.zygoat.ca $soatime 120 120 600 120', change_date='$time' WHERE
type='SOA'";
It would be nice if PDNS would be smarter this way, but alas. On the
other hand, since some of my existing zones were using the canonical
date-like serial format, I realised that the unix timestamp wouldn't cut
it anyhow (since as a scalar it was too small, being a couple of digits
short).
In the above, the last two digits represent a percentage of time through
the day, which means as long as I don't make updates more frequently than
every 11 minutes or so, it is unnecessary to think about the serial.
-b
--
Ben Kennedy, chief magician
zygoat creative technical services
613-228-3392 | 1-866-466-4628
http://www.zygoat.ca
More information about the Pdns-users
mailing list