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.
47 # Tell linux cd/pwd not to be so "helpful".
48 # This will generate an ignorable error on older platforms.
54 if test $SRC_DIR != `pwd`
60 # make sure SRC_DIR is empty
61 /bin/rm -rf $SRC_DIR/*
63 # Alert if tarfile doesn't exist
71 # Don't put up with errors extracting the information
78 # Make sure the file is not zero-length
92 # Kill off the current named and remove the named.pid file. It is
93 # important that this file be removed since the script uses its
94 # existance as evidence that named as has been successfully restarted.
96 # First, get statistics
97 /usr/athena/etc/rndc stats
99 kill -KILL `cat $NAMED_PID`
107 # This timeout is implemented by having the shell check TIMEOUT times
108 # for the existance of $NAMED_PID and to sleep INTERVAL seconds
109 # between each check.
111 TIMEOUT=60 # number of INTERVALS until timeout
112 INTERVAL=60 # number of seconds between checks
114 while test $i -lt $TIMEOUT
116 if test -f $NAMED_PID
123 echo out of timeout loop
125 if test $i -eq $TIMEOUT