Use extended regex
And remove useless escaping
This commit is contained in:
parent
93608a4147
commit
183fabf936
|
@ -73,9 +73,9 @@ inc_and_reload () {
|
||||||
zonefile="$BINDROOT/db.$domain"
|
zonefile="$BINDROOT/db.$domain"
|
||||||
|
|
||||||
# Set the date for serial (only if greater than actual serial)
|
# Set the date for serial (only if greater than actual serial)
|
||||||
serial=$(grep -P '^[ \t]*[0-9]{10}[ \t]*; serial' $zonefile | sed "s/^[ \t]*\([0-9]\{10\}\)[ \t]*; serial/\1/")
|
serial=$(grep -P '^[ \t]*[0-9]{10}[ \t]*; serial' $zonefile | sed -r "s/^[ \t]*([0-9]{10})[ \t]*; serial/\1/")
|
||||||
if [ `date "+%Y%m%d%H"` -gt $serial ]; then serial=$(date "+%Y%m%d%H"); else serial=$(( $serial + 1 )); fi
|
if [ `date "+%Y%m%d%H"` -gt $serial ]; then serial=$(date "+%Y%m%d%H"); else serial=$(( $serial + 1 )); fi
|
||||||
sed -i "s/^\([ \t]*\)[0-9]\{10\}\([ \t]*; serial\)/\1$serial\2/" \
|
sed -ri "s/^([ \t]*)[0-9]{10}([ \t]*; serial)/\1$serial\2/" \
|
||||||
$zonefile
|
$zonefile
|
||||||
if stderr=$(named-checkzone $domain $zonefile 2>&1); then
|
if stderr=$(named-checkzone $domain $zonefile 2>&1); then
|
||||||
rndc reload
|
rndc reload
|
||||||
|
|
Loading…
Reference in a new issue