summaryrefslogtreecommitdiff
path: root/prim2sec.sh
blob: af9f2d1b4a013b2d11d4298b7eb8cfb673a94ea3 (plain)
  1. #!/bin/sh
  2. #
  3. # /usr/local/sbin/prim2sec.sh
  4. # Copyright 2002 Juri Jensen <juri@xenux.dk>
  5. # Tweaks by Jonas Smedegaard <dr@jones.dk>
  6. #
  7. # $Id: prim2sec.sh,v 1.4 2003-05-05 09:50:53 jonas Exp $
  8. #
  9. # Script to convert named.conf include file for primary nameserver
  10. # to a named.conf include file for secondary nameserver.
  11. primfile=$1
  12. primserver=$2
  13. if ! [ -f $primfile -a -n "$primserver" ]; then
  14. echo "Usage: `basename $0` primfile primserver > secfile"
  15. echo
  16. echo "Example: `basename $0` named_XENUX_pri.conf 195.184.98.98 > named_XENUX_sec.conf"
  17. exit 1
  18. fi
  19. domains=`cat $primfile | egrep '^zone[[:space:]]' | sed 's/^zone[[:space:]]\+"\([^"]\+\)".*/\1/' | sort`
  20. for domain in $domains; do
  21. echo "zone \"$domain\" { type slave; file \"db.$domain\"; masters { $primserver; }; };"
  22. done