comparison scripts/nameserver_autogen/bind_tld_zonefile_all.sh @ 1191:56c959ab3e05 draft

use UTC for dates, 1->21
author cathugger <cathugger@cock.li>
date Fri, 10 Mar 2017 00:46:19 +0000
parents dae39c508416
children dfda92fd4ec3
comparison
equal deleted inserted replaced
1190:dae39c508416 1191:56c959ab3e05
1 #!/bin/bash 1 #!/bin/bash
2 #made for bash. not sure if all /bin/sh work. 2 #made for bash. not sure if all /bin/sh work.
3 #be sure to edit these variables first. 3 #be sure to edit these variables first.
4 4
5 #ZONEFILE_DIR=/etc/namedb 5 #ZONEFILE_DIR=/etc/namedb
6 RDNS_ZONEFILE=/etc/namedb/21.in-addr.arpa 6 #RDNS_ZONEFILE=/etc/namedb/21.in-addr.arpa
7 #RESDB_PATH=/var/db/resdb 7 #RESDB_PATH=/var/db/resdb
8 8
9 if [ ! "$ZONEFILE_DIR" ];then 9 if [ ! "$ZONEFILE_DIR" ];then
10 echo "You forgot to set some variables. read the source plzkthx." 10 echo "You forgot to set some variables. read the source plzkthx."
11 exit 0; 11 exit 0;
12 fi 12 fi
13 13
14 14
15 echo -n "generating ipv4 reverse lookup zonefile for 21/8..." 15 echo -n "generating ipv4 reverse lookup zonefile for 21/8..."
16 16
17 echo "; this zonefile genreated on: `date`" > "$RDNS_ZONEFILE" 17 echo "; this zonefile genreated on: `date -u`" > "$RDNS_ZONEFILE"
18 echo '$TTL 3600' >> "$RDNS_ZONEFILE" 18 echo '$TTL 3600' >> "$RDNS_ZONEFILE"
19 echo '@ IN SOA @ root ('`date +" %Y%m%d%H"`' 60 300 3600000 3600 )' >> "$RDNS_ZONEFILE" 19 echo '@ IN SOA @ root ('`date -u +" %Y%m%d%H"`' 60 300 3600000 3600 )' >> "$RDNS_ZONEFILE"
20 echo '@ IN NS @' >> "$RDNS_ZONEFILE" 20 echo '@ IN NS @' >> "$RDNS_ZONEFILE"
21 echo '@ IN A 127.0.0.1' >> "$RDNS_ZONEFILE" 21 echo '@ IN A 127.0.0.1' >> "$RDNS_ZONEFILE"
22 22
23 for i in `ls ${RESDB_PATH}/db/ip/15/*/*/ns/*`;do #this is for 21. 23 for i in `ls ${RESDB_PATH}/db/ip/15/*/*/ns/*`;do #this is for 21.
24 f=$(basename $i) 24 f=$(basename $i)
33 33
34 cd ${GOHERE} 34 cd ${GOHERE}
35 TLD=$(basename ${GOHERE}) 35 TLD=$(basename ${GOHERE})
36 ANO_ZONEFILE=${ZONEFILE_DIR}/${TLD} 36 ANO_ZONEFILE=${ZONEFILE_DIR}/${TLD}
37 echo -n generating .${TLD} TLD zonefile... 37 echo -n generating .${TLD} TLD zonefile...
38 echo "; this zonefile genreated on: `date`" > "$ANO_ZONEFILE" 38 echo "; this zonefile genreated on: `date -u`" > "$ANO_ZONEFILE"
39 echo '$TTL 3600' >> "$ANO_ZONEFILE" 39 echo '$TTL 3600' >> "$ANO_ZONEFILE"
40 echo '@ IN SOA @ root ('`date +" %Y%m%d%H"`' 60 300 3600000 3600 )' >> "$ANO_ZONEFILE" 40 echo '@ IN SOA @ root ('`date -u +" %Y%m%d%H"`' 60 300 3600000 3600 )' >> "$ANO_ZONEFILE"
41 echo '@ IN NS @' >> "$ANO_ZONEFILE" 41 echo '@ IN NS @' >> "$ANO_ZONEFILE"
42 echo '@ IN A 127.0.0.1' >> "$ANO_ZONEFILE" 42 echo '@ IN A 127.0.0.1' >> "$ANO_ZONEFILE"
43 43
44 for name in *;do 44 for name in *;do
45 if [ -e "${name}/ns/" ];then 45 if [ -e "${name}/ns/" ];then