Ignore:
Timestamp:
May 30, 2010, 4:31:58 PM (16 years ago)
Author:
richardvm
Message:

Fixed reverse dns, no arpa zones where loaded

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 2.0/nanobsd/nanobsd/files/usr/local/sbin/fetchzone.sh

    r7625 r8101  
    22
    33# Set some vars
    4 ZONE=wleiden.net
     4ZONES="wleiden.net 16.172.in-addr.arpa. 17.172.in-addr.arpa.
     518.172.in-addr.arpa. 19.172.in-addr.arpa. 20.172.in-addr.arpa.
     621.172.in-addr.arpa. 22.172.in-addr.arpa. 23.172.in-addr.arpa.
     724.172.in-addr.arpa. 25.172.in-addr.arpa. 26.172.in-addr.arpa.
     827.172.in-addr.arpa. 28.172.in-addr.arpa. 29.172.in-addr.arpa.
     930.172.in-addr.arpa. 31.172.in-addr.arpa."
     10
    511SERVER=195.169.86.131
    612APP=/usr/local/bin/fetchzone
    7 TMPFILE=/tmp/dns-${ZONE}.tmp
    8 REALFILE=/usr/local/etc/maradns/db.${ZONE}
    913LOGFILE=/var/log/fetchzone.log
    1014PIDFILE=/var/run/fetchzone.pid
     
    2024echo ${PID} > ${PIDFILE}
    2125
    22 # No zone file to compare with, so lets make a dummy
    23 touch ${REALFILE}
    24 
    2526# Tell logfile that I am starting
    2627log "[INFO] Fetchzone starting with PID: $PID"
     
    2930while [ true ]; do
    3031
    31   # Execute Fetchzone
    32   ${APP} ${ZONE} ${SERVER} > ${TMPFILE}
     32  # Run through multiple zones
     33  for ZONE in ${ZONES}
     34  do
    3335
    34   # Did Fetchzone exit unhappy
    35   if [ $? -eq 0 ]; then
     36    # (re) Set some extra vars
     37    TMPFILE=/tmp/dns-${ZONE}.tmp
     38    REALFILE=/usr/local/etc/maradns/db.${ZONE}
     39    # Execute Fetchzone
     40    ${APP} ${ZONE} ${SERVER} > ${TMPFILE}
     41 
     42    # Did Fetchzone exit unhappy
     43    if [ $? -eq 0 ]; then
     44 
     45      # Are there any changes?
     46      COMM=`comm -23 ${TMPFILE} ${REALFILE} 2>&1`
     47      if [ -n "$COMM" ]; then
     48 
     49        # If there are any changes copy tmp to realfile
     50        log "[INFO] Changes found"
     51        cp ${TMPFILE} ${REALFILE}
     52 
     53        # Maradns requires a restart to load new zonefile
     54        /usr/local/etc/rc.d/maradns restart
     55 
     56      fi
     57    else
     58 
     59      # Something went wrong lets log it
     60      log "[ERROR] Errors found in fetchzone query"
     61    fi
    3662
    37     # Are there any changes?
    38     COMM=`comm -23 ${TMPFILE} ${REALFILE}`
    39     if [ -n "$COMM" ]; then
    40 
    41       # If there are any changes copy tmp to realfile
    42       log "[INFO] Changes found"
    43       cp ${TMPFILE} ${REALFILE}
    44 
    45       # Maradns requires a restart to load new zonefile
    46       /usr/local/etc/rc.d/maradns restart
    47 
    48     fi
    49   else
    50 
    51     # Something went wrong lets log it
    52     log "[ERROR] Errors found in fetchzone query"
    53   fi
     63  done
    5464
    5565  # Lets go to sleep
    5666  sleep ${IDLE}
    5767done
     68
Note: See TracChangeset for help on using the changeset viewer.