Posted by Steve on Fri 31 Mar 2006 at 19:50
If you work with the DNS server bind you'll probably be used to updating the serial number for your zone files manually after making changes. If you're an Emacs user there is a simple automatic way of doing the job.
Thanks to a blog posting by Tollef Fog Heen I learnt today that there is an Emacs mode for working with Zone files. (Perhaps I shouldn't be suprised; there seems to be a mode for everything!)
If you make changes to your zone file Emacs will automatically update the serial number for you, in the canonical format of YYYYMMDDXX (where YYYY is the current year, MM is the current month, DD is the current day, and XX is the revision number).
Simply add the string "-*- zone -*-" to the head of the file. For example:
;; -*- zone -*- ;; ;; Zone file for example.org ;; example.org 86400 IN SOA example.org. hostmaster.example.org. ( 2006033100 ; Serial YYYYMMDDXX 10800 ; Refresh 3600 ; Retry 3600000 ; Expire 86400 ) ; minimum IN NS ns1.example.org. IN NS ns2.example.org. ...
The next time you load the file in Emacs you'll see that you've got syntax highlighting, and if you write any changes to the file the Serial will be incremented appropriately.
Obviously this won't help you if you use another editor, or another nameserver, but it was a neat trick that I thought was worth sharing.