Posts

Showing posts from June, 2013

FreeBSD: Increment the serial number of every zone file by 1

I needed to increment the serial number of every zone on a master server to trigger an update to a new slave. Since I know next to nothing about csh the easiest way was the following one liner in sh: for i in `ls -1 | xargs`; do j="`awk '$3 == "Serial"{print $1 + 1}' $i`"; sed -i "" "s/^[[:digit:]]\{10\}\([[:space:]]\;[[:space:]]Serial\)/$j\1/" $i; echo -n "$i "; rndc reload $i; sleep 2; done