Introduction
You may want to have a command-line method of incrementing a DNS zone serial and reloading the DNS zone without using an editor.
Procedure
The following perl one liner will search for a string that start with 202 is all digits [0-9] with 7 more digits than 202 and increment that number and then replace the number with the incremented number. In 2030 the 202 would be replaced with 203 or modify the one liner to (20\d{8}) which covers the entire century.
The first example will increase a single DNS zone for example mydomain.com
perl -pi -e 'if (/\s+(202\d{7})/i) { my $i = $1+1; s/$1/$i/; }' /var/named/mydomain.com.db
This next example will increment the serial to all files in /var/named with a .db extension which results in all DNS zones being updated.
perl -pi -e 'if (/\s+(202\d{7})/i) { my $i = $1+1; s/$1/$i/; }' /var/named/*db
After the DNS Zone serial has been increased the DNS server needs to be reloaded.
Bind/named
rndc reload
PowerDNS
pdns_control reload
Lastly, if there is a DNS cluster being used you can force sync domains using
/scripts/dnscluster synczone mydomain.com
or all with
/scripts/dnscluster syncall