#!/bin/bash # CHECK ALL THE ZONES ANYWHERE # THIS WILL OUTPUT NOTHING IF EVERYTHING IS FINE checkzone() { # domain_name zonefile output=`named-checkzone $1 $2 2>&1` if [ $? != 0 ]; then echo -e "\n$2 file has errors!\n\n" echo -e "$output\n" fi return 0 } # check everything if [ -d master ]; then for zonefile in master/*; do if [ "${zonefile:(-1)}" != '~' ]; then zone=`basename $zonefile` checkzone ${zone} ${zonefile} fi done fi if [ -d built ]; then for zonefile in built/*; do # ignore the dsset files and the README :( if ! [[ $zonefile == built/dsset* || $zonefile == built/README* || $zonefile == built/*~ || $zonefile == built/*.bak ]]; then if [ -f $zonefile ]; then zone=`basename $zonefile | sed -e "s/.signed//g"` checkzone ${zone} ${zonefile} fi fi done fi AREA="PHX2 QA NA EU DEFAULT" template_zones="cloud.fedoraproject.org fedoraproject.org getfedora.org" for zone in $template_zones; do for a in $AREA; do if [ -f built/$a/${zone} ]; then checkzone ${zone} built/$a/${zone} checkzone ${zone} built/$a/${zone}.signed fi done done # Check whether at least 3 proxies still remain in every region # this makes sure we can't silently kick out too many proxies for zone in $template_zones; do for a in $AREA; do if [ $a == "PHX2" -o $a == "QA" ]; then # PHX2 only has two proxies MINPROXIES=1 else MINPROXIES=3 fi NUM_PROXIES="$(grep "^@[ 0-9]*IN[ ]*A " built/$a/$zone | wc -l)" if [ $NUM_PROXIES -lt $MINPROXIES ]; then echo "*** Zone $zone, region $a, has too few proxies: $NUM_PROXIES (minimum required: $MINPROXIES)" exit -1 fi done done