Changeset 174
- Timestamp:
- 02/19/2007 10:13:02 PM (5 years ago)
- File:
-
- 1 edited
-
trunk/tools/zone_update/zone_update (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/zone_update/zone_update
r139 r174 1 1 #!/bin/bash 2 # zone_update bash script Version 0. 72 # zone_update bash script Version 0.8 3 3 # Copyleft 2005 - Ernest0x (ernest0x at yahoo dot gr) 4 4 … … 12 12 # Notes 13 13 # ----- 14 # - The php-generated zone file must include a line that contains a "; serial" substring.15 # This line gives its place to a new serial line, constructed by this script.16 # --------------------------------------------------------------------------------------- #14 # - Both your system's zone file and the php-generated zone file must include a 15 # line that contains a "; serial" comment string. This line gives its place to 16 # a new serial line, constructed by this script. 17 17 18 18 … … 41 41 exit 42 42 fi 43 44 # Check the syntax of the current zone file and make sure it includes "; serial" line 45 if ! ( named-checkzone -q $CUR_ZONE $ZONES_ROOT$CUR_ZONE && grep -q "; serial" $ZONES_ROOT$CUR_ZONE ) ; then 46 echo "`date` - $ZONES_ROOT$CUR_ZONE has errors (wrong syntax or missing '; serial' comment)." 47 echo "#### START of named-checkzone output (if OK then '; serial' comment is missing) ####" 48 echo "`named-checkzone $CUR_ZONE $ZONES_ROOT$CUR_ZONE`" 49 echo "#### END of named-checkzone output ####" 50 exit 51 fi 43 52 44 53 # Where we will temporarily save the php-generated zone file. … … 52 61 53 62 # Make PHP_ZONE 63 cd `dirname $PHP_SCRIPT` 54 64 php $PHP_SCRIPT $CUR_ZONE > $PHP_ZONE 55 65 … … 57 67 # Remember to change '2' to '3' on the next millenium change. :P 58 68 CUR_SERIAL=`grep "; serial" $ZONES_ROOT$CUR_ZONE | grep -o "2........."` 69 70 # Check the validity of CUR_SERIAL 71 CUR_SERIAL_CHARS=`echo -n $CUR_SERIAL | wc -m` 72 if [ $CUR_SERIAL_CHARS -ne 10 ] || ! date -d `echo $CUR_SERIAL | cut -c 1-8` > /dev/null 2>&1 ; then 73 echo "`date` - Serial line in $ZONES_ROOT$CUR_ZONE is not valid." 74 exit 75 fi 59 76 60 77 # Day Of CUR_SERIAL … … 118 135 mv -f /tmp/$CUR_ZONE $ZONES_ROOT 119 136 else 120 echo "PHP-generated file has errors (possible database failure)" 137 echo "`date` - PHP-generated file has errors (possible database failure)" 138 echo "#### START of named-checkzone output ####" 139 echo "`named-checkzone $CUR_ZONE /tmp/$CUR_ZONE`" 140 echo "#### END of named-checkzone output ####" 121 141 rm -f $PHP_ZONE $CUR_ZONE_S $PHP_ZONE_S /tmp/$CUR_ZONE 122 142 exit
Note: See TracChangeset
for help on using the changeset viewer.
