]> andersk Git - moira.git/commitdiff
Added a command-line arg, to allow the administrator to load only one
authordkk <dkk>
Tue, 4 Nov 1997 22:00:55 +0000 (22:00 +0000)
committerdkk <dkk>
Tue, 4 Nov 1997 22:00:55 +0000 (22:00 +0000)
of student or staff data files (instead of both together).  The
frequency of the two data files varied greatly, so the script was
being used only as an example until these changes were applied.

The script also now uses a separate directory (/moira/load/).

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.096214 seconds and 5 git commands to generate.