- bind_remove_domain.sh: remove unused code (after end of script)

- bind_change_ip.sh, bind_change_ttl.sh, bind_set_ttl_to_default.sh: reloade zone(s) if changed.
This commit is contained in:
2017-08-02 12:31:18 +02:00
parent af94d5de33
commit 52e2476dd4
4 changed files with 166 additions and 158 deletions

View File

@@ -548,76 +548,3 @@ fi
$LOGGING && echo ""
clean_up 0
echo ""
echo ""
echo -e "\033[32m--\033[m"
echo ""
echo ""
## - Read list of zonefiles
## -
while IFS='' read -r -d '' zone_file ; do
declare -i _serial_new=`date +%Y%m%d01`
filename=$(basename "$zone_file")
zone="${filename%.*}"
echo ""
echo -e "\tlooking at $zone_file.."
## - calculate new serial
## -
declare -i __serial=`grep -e "[0-9]\{10\}" $zone_file | grep serial | awk '{print$1}'`
while [ ! $_serial_new -gt $__serial ]; do
let _serial_new++
done
echononl "\t Changing SOA Record.."
if ! grep -E "^.*IN\s+SOA\s+${_soa_nameserver}\.\s+${_soa_admin}\.\s+\(" > /dev/null 2>&1 $zone_file ; then
perl -i -n -p -e "s/^(.*IN\s+SOA).*$/\1 ${_soa_nameserver}. ${_soa_admin}. \(/" $zone_file
if [ "$?" = "0" ]; then
echo_ok
else
echo_failed
fi
else
echo_skipped
continue
fi
## - Set new serial
## -
echononl "\t Renew serial.."
perl -i -n -p -e "s#^(\s*) $__serial(.*)#\1 $_serial_new\2#" $zone_file
if [ "$?" = "0" ]; then
echo_ok
else
echo_failed
fi
## - Reload Zone
## -
echononl "\t Reload Zone $zone.."
/usr/sbin/rndc reload $zone > /dev/null 2>&1
if [ "$?" = "0" ]; then
echo_ok
else
echo_failed
fi
sleep 1
done < <(find $_zone_files_dir -mindepth 1 -maxdepth 1 -type f -print0)
echo ""
clean_up 0