- Add/Archive old versions of script.
- Add some Readme's.
This commit is contained in:
40
OLD_Versions/bind_disable_ipv6.sh
Executable file
40
OLD_Versions/bind_disable_ipv6.sh
Executable file
@@ -0,0 +1,40 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#_zone_files_dir=/etc/bind/master
|
||||
_zone_files_dir=/root/tmp/master
|
||||
_comment=";; - IPv6 disabled "
|
||||
|
||||
cp -a $_zone_files_dir ${_zone_files_dir}.BAK-`date +%Y-%m-%d-%H%M`
|
||||
|
||||
__zonefiles=`grep -l -E "^[^;].*\s*AAAA" ${_zone_files_dir}/*.zone`
|
||||
|
||||
for zone_file in $__zonefiles ; do
|
||||
|
||||
_serial_new=`date +%Y%m%d01`
|
||||
|
||||
echo -e "\tconverting $zone_file .."
|
||||
|
||||
_replaced=false
|
||||
|
||||
## - 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
|
||||
|
||||
perl -i -n -p -e "s/^([^;]+.*\s+AAAA\s+.*)$/${_comment}\1/" $zone_file
|
||||
if [ $? -eq 0 ]; then
|
||||
_replaced=true
|
||||
fi
|
||||
|
||||
|
||||
## - setze neue serial
|
||||
## -
|
||||
if $_replaced ; then
|
||||
perl -i -n -p -e "s#^(\s*)\s$__serial(.*)#\1 $_serial_new\2#" $zone_file
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
exit
|
||||
Reference in New Issue
Block a user