dns-scripts/update-extzone.sh

21 lines
488 B
Bash

#!/bin/sh
. ./dns-functions.sh
InternalZoneFile="$1"
ExternalZoneFile="$2"
ExternalZone="$3"
ExternalView="$4"
SerialIntern="$(GetZoneFileSerial "$InternalZoneFile")"
if [ -f "$ExternalZoneFile" ]; then
SerialExtern="$(GetZoneFileSerial "$ExternalZoneFile")"
else
SerialExtern=0
fi
if [ $SerialIntern -gt $SerialExtern ]; then
sed '/.*\s\(10.\|[fF][cdCD][0-9a-fA-F]\{2\}:\)\S*\s*\(;.*\)\?/d' "$InternalZoneFile" > "$ExternalZoneFile"
ReloadZone "$ExternalZone" "$ExternalView"
fi