2 # This script performs updates of hesiod files on hesiod servers.
5 set path=(/etc /bin /usr/bin /usr/etc /usr/athena/etc)
7 # The following exit codes are defined and MUST BE CONSISTENT with the
8 # MR error codes the library uses:
9 set MR_HESFILE = 47836472
10 set MR_MISSINGFILE = 47836473
11 set MR_NAMED = 47836475
12 set MR_TARERR = 47836476
16 # File that will contain the necessary information to be updated
17 set TARFILE=/tmp/hesiod.out
18 # Directory into which we will empty the tarfile
19 set SRC_DIR=/etc/athena/_nameserver
20 # Directory into which we will put the final product
21 set DEST_DIR=/etc/athena/nameserver
23 # Create the destination directory if it doesn't exist
24 if (! -d $DEST_DIR) then
30 # If $SRC_DIR does not already exist, make sure that it gets created
31 # on the same parition as $DEST_DIR.
32 if (! -d $SRC_DIR) then
36 if ($SRC_DIR != `pwd`) then
41 # Alert if tarfile doesn't exist
42 if (! -r $TARFILE) exit $MR_MISSINGFILE
44 # Empty the tar file one file at a time and move each file to the
45 # appropriate place only if it is not zero length.
47 foreach file (`tar tf $TARFILE | awk '{print $1}' | sed 's;/$;;'`)
48 if (. == $file) continue
53 # Don't put up with errors extracting the information
54 if ($status) exit $MR_TARERR
55 # Make sure the file is not zero-length
58 if ($status != 0) exit $MR_HESFILE
65 # Kill off the current named and remove the named.pid file. It is
66 # important that this file be removed since the script uses its
67 # existance as evidence that named as has been successfully restarted.
69 # First, get statistics
70 ln -s /site/named.stats /usr/tmp/named.stats
71 kill -IOT `cat /etc/named.pid`
73 # Use /bin/kill because, due to a bug in some versions of csh, failure
74 # of a builtin will cause the script to abort
75 kill -KILL `cat /etc/named.pid`
79 (unlimit; /etc/named&)
81 mv /etc/named.pid /etc/named.pid.restart
83 # This timeout is implemented by having the shell check TIMEOUT times
84 # for the existance of /etc/named.pid and to sleep INTERVAL seconds
87 set TIMEOUT=60 # number of INTERVALS until timeout
88 set INTERVAL=60 # number of seconds between checks
92 if (-f /etc/named.pid) break
97 if ($i == $TIMEOUT) exit $MR_NAMED