]> andersk Git - moira.git/blame - gen/letter.sh
Case-insensitive stuff.
[moira.git] / gen / letter.sh
CommitLineData
78c00fd3 1#!/bin/sh
2# $Header$
3# This script prints the letters confirming registration for the extra
4# kerberos principal.
5
6# The algorithm consists of first checking to see that the previous
7# day's job printed. If so, the cached copy is deleted. Otherwise,
8# today's is appended to yesterday's and we continue working with that.
9
10PATH=/bin:/bin/athena:/usr/ucb:/usr/bin/athena:/usr/athena; export PATH
dd03c300 11printer=linus
78c00fd3 12newfile=/tmp/letter.out
13savefile=/u1/letter.save
92065bd9 14holdfile=/u1/letter.hold
78c00fd3 15
16# These are not normally local, so may need to point somewhere else
17lpquota=lpquota
18lpr=lpr
19colrm=colrm
20
21last=`$lpquota -l | tail -2`
22if [ "`echo $last | $colrm 1 4 | $colrm 7`" = \
23 "`ls -l $savefile | $colrm 1 32 | $colrm 7`" ]; then
24 mv $newfile $savefile
25else
0102b2e6 26 if [ -s $savefile ]; then
92065bd9 27 if [ ! -f $holdfile ]; then
28 (echo "Reg_extra letters failed to print yesterday"; \
29 ls -l $savefile; \
30 echo $last) | /bin/mail dbadmin thorne
31 fi
0102b2e6 32 cat $newfile >> $savefile
0102b2e6 33 else
34 mv $newfile $savefile
35 fi
78c00fd3 36fi
92065bd9 37rm -f $holdfile
78c00fd3 38
92065bd9 39if [ "`$lpr -P$printer -h $savefile`"x = "Printer queue is disabled."x ]; then
40 touch $holdfile
41fi
78c00fd3 42
43exit 0
This page took 0.108638 seconds and 5 git commands to generate.