问题原文
原帖链接 · Vinícius Ferrão · CC BY-SA 3.0
I've a BIND9 server with a lot of zones and I need to increase the serial number of the zone files by one. Some zones are using the YYYYMMDDXX format but other zones just increase it by one, as they are dynamic DNS zones, so updating all by one would do the job for me.
There's a way to do this? I tried with sed but I'm lacking knowledge to do this automatically.
已采纳解答
原帖链接 · MagicJack · CC BY-SA 4.0
This would be pretty difficult to do in 'sed' but it is fairly easy in 'awk'.
awk '{ if ( $0 ~ /[\t ]SOA[\t ]/ ) $7=$7+1; print}'
If it is an SOA line ("SOA" with a space or tab before and after it) then increment field 7 (serial number). Print every line.
This only increments the serial number which is what was asked, however you'll still need to trigger a reload and notifies to the secondary servers to propagate the changes.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
