]> andersk Git - moira.git/blobdiff - gen/letter.sh
Locking the data file while it was calculating the usages on each of the
[moira.git] / gen / letter.sh
index c6ff6a052443785aab70b88dc3ef3ca34242cb44..f56f1239dee105277485c64d7874449f0338f4f9 100644 (file)
@@ -8,9 +8,10 @@
 # today's is appended to yesterday's and we continue working with that.
 
 PATH=/bin:/bin/athena:/usr/ucb:/usr/bin/athena:/usr/athena; export PATH
-printer=nil
+printer=linus
 newfile=/tmp/letter.out
 savefile=/u1/letter.save
+holdfile=/u1/letter.hold
 
 # These are not normally local, so may need to point somewhere else
 lpquota=lpquota
@@ -22,10 +23,21 @@ if [ "`echo $last | $colrm 1 4 | $colrm 7`" = \
      "`ls -l $savefile | $colrm 1 32 | $colrm 7`" ]; then
        mv $newfile $savefile
 else
-       cat $newfile >> $savefile
-       echo "Reg_extra letter printing error" | /bin/mail dbadmin
+       if [ -s $savefile ]; then
+               if [ ! -f $holdfile ]; then
+                       (echo "Reg_extra letters failed to print yesterday"; \
+                       ls -l $savefile; \
+                       echo $last) | /bin/mail dbadmin thorne
+               fi
+               cat $newfile >> $savefile
+       else
+               mv $newfile $savefile
+       fi
 fi
+rm -f $holdfile
 
-$lpr -P$printer -h $savefile
+if [ "`$lpr -P$printer -h $savefile`"x = "Printer queue is disabled."x ]; then
+       touch $holdfile
+fi
 
 exit 0
This page took 0.263082 seconds and 4 git commands to generate.