User Tools

Site Tools


scripting:updatesoa.sh

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
scripting:updatesoa.sh [2015-03-08 22:32] – created gabrielscripting:updatesoa.sh [2019-08-10 17:25] (current) – moving gitab note to top gabriel
Line 1: Line 1:
 +====== updatesoa.sh ======
 +
 +//This script is now maintained on [[https://gitlab.com/gmobrien/updatesoa.sh|GitLab]] and no longer updated on this wiki.//
 +
 +I created this script as a simple reimplementation of a tool that I used in an old job.  It allows you to easily update the serial number for a DNS zone in an automated fashion avoiding errors.
 +
 +It's best used in conjunction with an $INCLUDE statement in the zone file referencing a separate SOA file, especially if multiple zones exist on your server.  All that should be necessary to use it is to modify the SOA variable to point to your record or zone file and to ensure that the line that the serial number is on contains the string "Serial" as a comment (such as in the default zones that ship with BIND9 on [[debian:|Debian]]).  You may need to modify the $SOA path depending on how you have configured your zone(s).
 +
 <code bash> <code bash>
 #!/bin/bash #!/bin/bash
 +#
 +# updatesoa.sh - a simple script to update BIND SOA serial numbers
 # #
 # Copyright (c) 2011 Gabriel M. O'Brien # Copyright (c) 2011 Gabriel M. O'Brien
Line 58: Line 68:
  
 </code> </code>
 +
 +If successful you will see something like this:
 +
 +<code bash>
 +root@jupiter:/etc/bind# ./updatesoa.sh
 +Current DNS serial:     2015030807
 +New DNS serial:         2015030808
 +SOA updated.
 +</code>
 +
 +Reminder: after this you will need to reload the zone!
 +
 +Obvious error conditions are trapped in the script but it is probably far from foolproof.
scripting/updatesoa.sh.1425868349.txt.gz · Last modified: 2015-03-08 22:32 by gabriel