]> andersk Git - moira.git/blobdiff - regtape/reg-update
Build the webmoira dir if we've generated a Makefile in it.
[moira.git] / regtape / reg-update
index 28ee8e65a6c60e8713c3dde9221762911fe1217d..44a0625dbf2a893206f2fdfdc7bac9b7aaf26e5b 100644 (file)
@@ -1,23 +1,41 @@
-#!/bin/sh
+#!/bin/sh -vx
 #
-#  Script to update Moira from Registrar's "tapes".
+#  Script to update Moira from Registrar and Personnel "tapes".
+
+if [ "filler $1" != "filler staff" -a "filler $1" != "filler student" ] ; then
+    echo "Bad argument $1"
+    echo "Usage: $0 [ staff | student ]"
+    exit 1
+fi
+who="$1"
+rdir=/moira
+bdir=$rdir/bin
+tdir=$rdir/tapes
+ldir=$rdir/load
 
 date=`date +%y%m%d`
-##### date=`expr $date - 1` # files are postdated by 1 day
-
-cd /moira/ || exit 1
-for who in  staff student ; do
-  if  [ -f tapes/$who.input.$date.Z ] ; then
-    [ -s $who.input ] \
-    && mv $who.input.0 $who.input.1 \
-    && mv $who.input   $who.input.0
-
-    zcat tapes/$who.input.$date.Z | bin/$who.cvt > $who.input
-
-    [ -s $who.input ] \
-    && [ `diff $who.input.0 $who.input | wc -l` -lt 500 ] \
-    && bin/$who -n $who.input > $who.output.$date 2>&1 \
-    && egrep -v "($who): (adding|updating)" $who.output.$date > $who.err 2>&1 \
-    && cat /usr/local/lib/mail_header $who.err | mail dkk
-  fi
-done
+date=`expr $date - 1` # files are postdated by 1 day
+
+cd "$ldir" || exit 2
+
+if  [ -f "$tdir/$who.input.$date.Z" ] ; then
+
+    if [ -f "$ldir/$who.input.$date" ] ; then
+       echo "Pre-existing $ldir/$who.input.$date, will not overwrite."
+       exit 3
+    fi
+
+    zcat "$tdir/$who.input.$date.Z" | "$bdir/$who.cvt" \
+       > "$ldir/$who.input.$date"
+
+    [ -s "$ldir/$who.input.$date" ] \
+    && [ `diff $ldir/$who.input.last $ldir/$who.input.$date |wc -l` -lt 500 ] \
+    && rm $ldir/$who.input.last \
+    && ln -s $who.input.$date $ldir/$who.input.last \
+    && $bdir/$who -n $ldir/$who.input.$date > $ldir/$who.output.$date 2>&1 \
+
+#    && egrep -v "($who): (adding|updating)" $ldir/$who.output.$date \
+#      > $ldir/$who.err.$date 2>&1 \
+#    && cat /usr/local/lib/mail_header $who.err | mail dkk
+
+fi
This page took 0.035611 seconds and 4 git commands to generate.