Last active
August 29, 2015 14:05
-
-
Save b4ldr/d1d6448af82a0c46b4de to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ZONE_PATH="/home/bind" | |
BIND_PATH="/var/lib/bind" | |
TMP=$(mktemp) | |
FC="dns.zones.txt" | |
for ZONE in $(awk '$2=="Primary" {print $1}' "${ZONE_PATH}/${FC}") | |
do | |
echo -e "zone ${ZONE} {\n\ttype slave;\n\tmasters { 192.168.1.100; };\n\tfile \"${BIND_PATH}/${ZONE}.zone\";\n};" | |
done > ${TMP} | |
for ZONE in "${BIND_PATH}/*.zone" | |
do | |
grep -q "^${ZONE##*/}" "${TMP}" || rm "${ZONE}" | |
done | |
mv ${TMP} /etc/bind/named.conf.slave-zones | |
rndc reload |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ZONE_PATH="/home/bind" | |
BIND_PATH="/var/lib/bind" | |
TMP=$(mktemp) | |
FC="dns.zones.txt" | |
for ZONE in $(awk '$2=="Primary" {print $1}' "${ZONE_PATH}/${FC}") | |
do | |
printf "zone %s {\n\ttype slave;\n\tmasters { 192.168.1.100; };\n\tfile \"%s/%s.zone\";\n};\n" "${ZONE}" "${BIND_PATH}" "${ZONE}" | |
done > ${TMP} | |
for ZONE in "${BIND_PATH}/*.zone" | |
do | |
grep -q "^${ZONE##*/}" "${TMP}" || rm "${ZONE}" | |
done | |
mv ${TMP} /etc/bind/named.conf.slave-zones | |
rndc reload |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment