source: genesis/tools/fresh-dns.sh@ 9525

Last change on this file since 9525 was 9525, checked in by rick, 13 years ago

Relocate to new paths

  • Property svn:executable set to *
File size: 977 bytes
Line 
1#!/bin/sh
2#
3# Deploy fresh/changed WL autogenerated DNS zones
4#
5CONFIGROOT='/usr/local/www/wlconfig/nodes/'
6DEPLOYROOT='/etc/namedb/master'
7
8TFILE=`mktemp /tmp/$(basename $0).XXXXX`
9trap "rm $TFILE; exit 1" 1 2 3 15
10
11# Generate new DNS and only complain/die on errors
12(
13 svn up $CONFIGROOT $CONFIGROOT/../dns || exit 1
14 $CONFIGROOT/genesis-to-yaml.pl $CONFIGROOT/*/wleiden.conf || exit 1
15 $CONFIGROOT/gformat.py dns || exit 1
16) 2>&1 > $TFILE || { cat $TFILE; exit 1; }
17
18
19UPDATE_ZONES=""
20# Check all zone files for updates
21for NEW in $CONFIGROOT/dns/*; do
22 ZONE=`basename $NEW | cut -c 4-`
23 OLD=$DEPLOYROOT/`basename $NEW`
24
25 # Contains new data?
26 diff -I 'SOA' $OLD $NEW
27 if [ $? -eq 0 ]; then
28 continue
29 fi
30
31 # Syntax valid?
32 named-checkzone $ZONE $NEW
33 if [ $? -ne 0 ] ; then
34 continue
35 fi
36
37 # Deploy
38 cp $NEW $OLD
39 UPDATE_ZONES="$UPDATE_ZONES $ZONE"
40done
41
42# Make sure to reload if updates are executed
43if [ -n "$UPDATE_ZONES" ]; then
44 rndc reload
45fi
Note: See TracBrowser for help on using the repository browser.