Index: 2.0/nanobsd/nanobsd/files/usr/local/etc/rc.d/fetchzone
===================================================================
--- 2.0/nanobsd/nanobsd/files/usr/local/etc/rc.d/fetchzone	(revision 7593)
+++ 2.0/nanobsd/nanobsd/files/usr/local/etc/rc.d/fetchzone	(revision 7593)
@@ -0,0 +1,26 @@
+#!/bin/sh
+#
+# PROVIDE: fetchzone
+# REQUIRE: maradns
+# KEYWORD: shutdown
+#
+# Add the following line to /etc/rc.conf to enable fetchzone:
+#
+# fetchzone_enable="YES"
+#
+. /etc/rc.subr
+
+name=fetchzone
+rcvar=`set_rcvar`
+
+command_interpreter=/bin/sh
+command=/usr/local/sbin/fetchzone.sh
+command_args="&"
+
+load_rc_config ${name}
+
+fetchzone_enable=${fetchzone_enable-"NO"}
+fetchzone_pidfile=${fetchzone_pidfile-"/var/run/fetchzone.pid"}
+pidfile="${fetchzone_pidfile}"
+
+run_rc_command "$1"
Index: 2.0/nanobsd/nanobsd/files/usr/local/sbin/fetchzone.sh
===================================================================
--- 2.0/nanobsd/nanobsd/files/usr/local/sbin/fetchzone.sh	(revision 7593)
+++ 2.0/nanobsd/nanobsd/files/usr/local/sbin/fetchzone.sh	(revision 7593)
@@ -0,0 +1,57 @@
+#!/bin/sh
+
+# Set some vars
+ZONE=wleiden.net
+SERVER=195.169.86.131
+APP=fetchzone
+TMPFILE=/tmp/dns-${ZONE}.tmp
+REALFILE=/usr/local/etc/maradns/db.${ZONE}
+LOGFILE=/var/log/fetchzone.log
+PIDFILE=/var/run/fetchzone.pid
+IDLE=600
+
+# Create logging service
+log() {
+  echo `date "+%b %e %T"`":" $* >> ${LOGFILE}
+}
+
+# Register PID
+PID=$$
+echo ${PID} > ${PIDFILE}
+
+# No zone file to compare with, so lets make a dummy
+touch ${REALFILE}
+
+# Tell logfile that I am starting
+log "[INFO] Fetchzone starting with PID: $PID"
+
+# Make sure I never die
+while [ true ]; do 
+
+  # Execute Fetchzone
+  ${APP} ${ZONE} ${SERVER} > ${TMPFILE}
+
+  # Did Fetchzone exit unhappy
+  if [ $? -eq 0 ]; then
+
+    # Are there any changes?
+    COMM=`comm -23 ${TMPFILE} ${REALFILE}`
+    if [ -n "$COMM" ]; then
+
+      # If there are any changes copy tmp to realfile
+      log "[INFO] Changes found"
+      cp ${TMPFILE} ${REALFILE}
+
+      # Maradns requires a restart to load new zonefile
+      /usr/local/etc/rc.d/maradns restart
+
+    fi
+  else
+
+    # Something went wrong lets log it
+    log "[ERROR] Errors found in fetchzone query"
+  fi
+
+  # Lets go to sleep
+  sleep ${IDLE}
+done
