23 lines
638 B
Bash
23 lines
638 B
Bash
|
#!/bin/sh
|
||
|
|
||
|
GetZoneFileSerial() {
|
||
|
INSOASpec="^\s*\S\+\s\+\([0-9]*\s\)\?\s*IN\s\+SOA\s\+"
|
||
|
FirstSOALineAndFollowing="/""$INSOASpec""/,\$!d;"
|
||
|
RemoveComments=":a;s/;.*$//g;"
|
||
|
RemoveLineBreaks=":a;N;\$!ba;s/\n//g;"
|
||
|
SearchPrintSerial="s/""$INSOASpec""\S\+\s\+\S\+\s\+\((\s\)\?\s*\([0-9]*\).*/\3/i"
|
||
|
|
||
|
ZoneSerial=$(sed -e "$FirstSOALineAndFollowing""$RemoveComments""$RemoveLineBreaks""$SearchPrintSerial" "$1")
|
||
|
echo "${ZoneSerial:-0}"
|
||
|
}
|
||
|
|
||
|
ReloadZone() {
|
||
|
if [ $DNSSCRIPT_BIND_RELOAD_VER -eq 0 ]; then
|
||
|
systemctl reload bind9
|
||
|
elif [ $DNSSCRIPT_BIND_RELOAD_VER -eq 1 ]; then
|
||
|
rndc reload "$1" IN "$2"
|
||
|
else
|
||
|
/etc/init.d/named reload
|
||
|
fi
|
||
|
}
|