Changeset 1315


Ignore:
Timestamp:
11/26/04 00:44:45 (8 years ago)
Author:
anonymous
Message:

clarify named restart code
use conf instead of meaning i variable name

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/slavedns

    r1314 r1315  
    77BINDDIR=/etc/bind/slavedns 
    88BINDINCLUDE=/etc/bind/slavedns.conf 
     9 
     10#NAMED9=/usr/pkg/etc/rc.d/named9 # BIND9 on NetBSD 
     11#NAMED8=/etc/rc.d/named # BIND8 on NetBSD/FreeBSD/OpenBSD 
     12NAMED8=/etc/init.d/named # BIND8 on some Linux 
     13NAMED9=/etc/init.d/named9 # BIND9 on some Linux 
     14#NAMED8=/etc/init.d/bind # BIND8 on other Linux 
     15#NAMED9=/etc/init.d/bind9 # BIND9 on other Linux 
     16 
     17NAMED="${NAMED8} ${NAMED9}" 
    918 
    1019CreateBindConf() { 
     
    3544rm -f ${BINDINCLUDE}.temp 
    3645 
    37 for i in `ls | grep -v slavedns.conf | grep -v '~$' ` 
     46for conf in `ls | grep -v slavedns.conf | grep -v '~$' ` 
    3847do 
    3948  # HOST LOGIN PASSWORD MASTERIP 
     
    4352  PASSWORD="" 
    4453  SSL="" 
    45   . ./$i 
     54  . ./${conf} 
    4655  if [ -z "$HOST" -o -z "$LOGIN" -o -z "$PASSWORD" -o -z "$MASTERIP" ] 
    4756  then 
    48       echo "error in the config file '$i'" >&2 
     57      echo "error in the config file '${conf}'" >&2 
    4958  else 
    5059      if [ "$SSL" ]  
     
    5463          PROTOCOL="http" 
    5564      fi 
    56       touch ${CACHEDIR}/${i} 
    57       rm -f ${CACHEDIR}/${i}.temp 
    58       wget ${PROTOCOL}://${HOST}/admin/domlist.php --http-user ${LOGIN} --http-passwd ${PASSWORD} -O ${CACHEDIR}/${i}.temp -t 1 -T 5 2>/dev/null 
    59       if [ -s "${CACHEDIR}/${i}.temp" ] 
     65      touch ${CACHEDIR}/${conf} 
     66      rm -f ${CACHEDIR}/${conf}.temp 
     67      wget ${PROTOCOL}://${HOST}/admin/domlist.php --http-user ${LOGIN} --http-passwd ${PASSWORD} -O ${CACHEDIR}/${conf}.temp -t 1 -T 5 2>/dev/null 
     68      if [ -s "${CACHEDIR}/${conf}.temp" ] 
    6069      then 
    6170          # If the slave file has changed, synchronize it. 
    62           if diff ${CACHEDIR}/${i}.temp ${CACHEDIR}/${i} -q &>/dev/null 
     71          if diff ${CACHEDIR}/${conf}.temp ${CACHEDIR}/${conf} -q &>/dev/null 
    6372          then 
    64               echo -n "no change found for '$i'" 
     73              echo -n "no change found for '${conf}'" 
    6574          else 
    66               echo -n "change detected for '$i', applying" 
    67               cp -f ${CACHEDIR}/${i}.temp ${CACHEDIR}/${i} 
     75              echo -n "change detected for '${conf}', applying" 
     76              cp -f ${CACHEDIR}/${conf}.temp ${CACHEDIR}/${conf} 
    6877              # Now parse the slave file and send it to /etc/bind/slavedns 
    69               CreateBindConf ${i}  
     78              CreateBindConf ${conf}  
    7079              RELOAD="YES" 
    7180          fi 
    7281      else 
    73           echo "Error: downloaded file for '$i' has zero size" >&2 
     82          echo "Error: downloaded file for '${conf}' has zero size" >&2 
    7483      fi 
    7584  fi 
     
    7988then 
    8089    mv -f ${BINDINCLUDE}.temp ${BINDINCLUDE} 
    81     if [ -e "/etc/init.d/bind" ] 
    82     then 
    83         /etc/init.d/bind reload 
    84     fi 
    85     if [ -e "/etc/init.d/bind9" ] 
    86     then 
    87         /etc/init.d/bind9 reload 
    88     fi 
     90    for script in $NAMED 
     91    do 
     92      if [ -x $script ] 
     93      then 
     94          ${script} reload 
     95      fi 
     96    done 
    8997fi 
Note: See TracChangeset for help on using the changeset viewer.