- Timestamp:
- Oct 31, 2010, 3:26:55 AM (14 years ago)
- Location:
- 2.0/nanobsd/nanobsd/files/usr/local
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
2.0/nanobsd/nanobsd/files/usr/local/etc/mararc
r8101 r8599 10 10 #csv2["example.com."] = "db.example.com" 11 11 12 csv2["wleiden.net."] = "db.wleiden.net "12 csv2["wleiden.net."] = "db.wleiden.net." 13 13 csv2["16.172.in-addr.arpa."] = "db.16.172.in-addr.arpa." 14 14 csv2["17.172.in-addr.arpa."] = "db.17.172.in-addr.arpa." -
2.0/nanobsd/nanobsd/files/usr/local/sbin/fetchzone.sh
-
Property svn:keywords
set to
Id
r8101 r8599 1 1 #!/bin/sh 2 # $Id$ 3 # 4 # Wireless Leiden specific configuration to fetch DNS zones 5 # used by MaraDNS 6 # 2 7 3 # Set some vars4 ZONES="wleiden.net 16.172.in-addr.arpa. 17.172.in-addr.arpa.8 # Updates of $ZONES we are going to fetch from the $SERVER every $IDLE seconds 9 ZONES="wleiden.net. 16.172.in-addr.arpa. 17.172.in-addr.arpa. 5 10 18.172.in-addr.arpa. 19.172.in-addr.arpa. 20.172.in-addr.arpa. 6 11 21.172.in-addr.arpa. 22.172.in-addr.arpa. 23.172.in-addr.arpa. … … 8 13 27.172.in-addr.arpa. 28.172.in-addr.arpa. 29.172.in-addr.arpa. 9 14 30.172.in-addr.arpa. 31.172.in-addr.arpa." 15 SERVER=172.16.4.46 16 IDLE=3600 10 17 11 SERVER=195.169.86.13112 APP=/usr/local/bin/fetchzone13 18 LOGFILE=/var/log/fetchzone.log 14 19 PIDFILE=/var/run/fetchzone.pid 15 IDLE=3600 20 ### END OF USER CONFIGURABLE VARIABLES ### 21 16 22 17 23 # Create logging service … … 23 29 PID=$$ 24 30 echo ${PID} > ${PIDFILE} 25 26 # Tell logfile that I am starting27 31 log "[INFO] Fetchzone starting with PID: $PID" 28 32 29 # Make sure I never die33 # Make me a deamon script 30 34 while [ true ]; do 31 35 36 CHANGED_ZONES="" 32 37 # Run through multiple zones 33 for ZONE in ${ZONES} 34 do 35 38 for ZONE in ${ZONES}; do 36 39 # (re) Set some extra vars 37 TMPFILE=/tmp/dns- ${ZONE}.tmp40 TMPFILE=/tmp/dns-tmp-${ZONE} 38 41 REALFILE=/usr/local/etc/maradns/db.${ZONE} 39 42 # Execute Fetchzone 40 ${APP}${ZONE} ${SERVER} > ${TMPFILE}43 /usr/local/bin/fetchzone ${ZONE} ${SERVER} > ${TMPFILE} 41 44 42 45 # 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 46 if [ $? -ne 0 ]; then 59 47 # Something went wrong lets log it 60 log "[ERROR] Errors found in fetchzone query" 48 log "[ERROR] [$ZONE] Errors found in fetchzone query" 49 continue 61 50 fi 62 51 52 # Are there any changes, we need to put active? 53 diff -Nq ${TMPFILE} ${REALFILE} 54 if [ $? -eq 1 ]; then 55 log "[INFO] [$ZONE] Changes found" 56 cp ${TMPFILE} ${REALFILE} 57 CHANGED_ZONES="$CHANGED_ZONES $ZONE" 58 fi 63 59 done 64 60 65 # Lets go to sleep 61 # Maradns requires a restart to load new zonefile 62 if [ -n "$CHANGED_ZONES" ]; then 63 log "[INFO] `/usr/local/etc/rc.d/maradns restart`" 64 fi 65 66 # Next run in $IDLE seconds 66 67 sleep ${IDLE} 67 68 done -
Property svn:keywords
set to
Note:
See TracChangeset
for help on using the changeset viewer.