source: trunk/third/moira/gen/www.sh @ 24319

Revision 24319, 1.5 KB checked in by broder, 14 years ago (diff)
New Moira snapshot from SVN.
RevLine 
[23095]1#!/bin/sh
2# This script performs updates of the web server.
[24319]3# $HeadURL: svn+ssh://svn.mit.edu/moira/trunk/moira/gen/www.sh $ $Id: www.sh 3956 2010-01-05 20:56:56Z zacheiss $
[23095]4
5PATH=/sbin:/bin:/usr/sbin:/usr/bin:/etc:/usr/etc:/usr/athena/bin:/usr/local/bin
6export PATH
7
8if [ -d /var/athena ] && [ -w /var/athena ]; then
9    exec >/var/athena/moira_update.log 2>&1
10else
11    exec >/tmp/moira_update.log 2>&1
12fi
13
14# The following exit codes are defined and MUST BE CONSISTENT with the
15# error codes the library uses:
16MR_HESFILE=47836472
17MR_MISSINGFILE=47836473
18MR_NAMED=47836475
19MR_TARERR=47836476
20MR_MKCRED=47836474
21
22umask 22
23
24TARFILE=/usr/tmp/www.out
25SRC_DIR=/usr/local/apache/etc
26BIN_DIR=/usr/local/apache/bin
27DEST_DIR=/usr/local/apache/etc
28
29if [ ! -r $TARFILE ]; then
30        exit $MR_MISSINGFILE
31fi
32
33cd $SRC_DIR
34rm -rf build
35mkdir build
36if [ $? != 0 ]; then
37        exit $MR_TARERR
38fi
39
40rm -rf save2
41if [ -d save ]; then
42        mv -f save save2
43fi
44mkdir save
45if [ $? != 0 ]; then
46        exit $MR_TARERR
47fi
48
49cd build
50
51for file in `tar tf $TARFILE | awk '{print $1}' | sed 's;/$;;'` ; do
52        if [ $file != . ]; then
53                rm -rf $file
54                echo extracting $file
55                tar xf $TARFILE $file
56                if [ $? != 0 ]; then
57                         exit $MR_TARERR
58                fi
59                $BIN_DIR/dbmanage $file import $file.db
60                if [ $? != 0 ]; then
61                        exit $MR_MKCRED
62                fi
63                mv $DEST_DIR/$file $SRC_DIR/save/$file
64                mv $DEST_DIR/$file.db $SRC_DIR/save/$file.db
65                mv $SRC_DIR/build/$file $DEST_DIR/$file
66                mv $SRC_DIR/build/$file.db $DEST_DIR/$file.db
67        fi
68done
69
70cd ..
71
72rm -f $TARFILE
73echo removed tarfile
74rm -f $0
75echo removed self
76
77exit 0
Note: See TracBrowser for help on using the repository browser.