2 # This script performs updates of hesiod files on hesiod servers.
5 if [ -d /var/athena ] && [ -w /var/athena ]; then
6 exec >/var/athena/moira_update.log 2>&1
8 exec >/tmp/moira_update.log 2>&1
13 PATH=/etc:/bin:/usr/bin:/usr/etc:/usr/athena/etc
16 # The following exit codes are defined and MUST BE CONSISTENT with the
17 # error codes the library uses:
19 MR_MISSINGFILE=47836473
25 # File that will contain the necessary information to be updated
26 TARFILE=/var/tmp/hesiod.out
27 # Directory into which we will empty the tarfile
28 SRC_DIR=/etc/athena/_nameserver
29 # Directory into which we will put the final product
30 DEST_DIR=/etc/athena/nameserver
32 NAMED=/etc/athena/named
33 NAMED_PID=/var/athena/named.pid
35 # Create the destination directory if it doesn't exist
36 if test ! -d $DEST_DIR
43 # If $SRC_DIR does not already exist, make sure that it gets created
44 # on the same parition as $DEST_DIR.
50 if test $SRC_DIR != `pwd`
56 # make sure SRC_DIR is empty
57 /bin/rm -rf $SRC_DIR/*
59 # Alert if tarfile doesn't exist
67 # Don't put up with errors extracting the information
74 # Make sure the file is not zero-length
88 # Kill off the current named and remove the named.pid file. It is
89 # important that this file be removed since the script uses its
90 # existance as evidence that named as has been successfully restarted.
92 # First, get statistics
93 /usr/athena/etc/rndc stats
95 kill -KILL `cat $NAMED_PID`
103 # This timeout is implemented by having the shell check TIMEOUT times
104 # for the existance of $NAMED_PID and to sleep INTERVAL seconds
105 # between each check.
107 TIMEOUT=60 # number of INTERVALS until timeout
108 INTERVAL=60 # number of seconds between checks
110 while test $i -lt $TIMEOUT
112 if test -f $NAMED_PID
119 echo out of timeout loop
121 if test $i -eq $TIMEOUT