3 # This script prints the letters confirming registration for the extra
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.
11 $newfile = "/tmp/letter.out";
12 $savefile = "/u1/letter.save";
13 $holdfile = "/u1/letter.hold";
15 $printed =`lpquota -l | tail -2`;
16 @printed = split(/\s+/, $printed);
18 $filed = `ls -l $savefile`;
19 @filed = split(/\s+/, $filed);
21 if ($printed[1] eq $filed[4] && $printed[2] eq $filed[5]) {
22 system("mv $newfile $savefile");
25 if ( ! -f $holdfile) {
26 open(MAIL, "|/bin/mail dbadmin thorne");
27 print MAIL "To: dbadmin, thorne\n";
28 print MAIL "Subject: reg_extra printing error\n";
29 print MAIL "Reg_extra letters failed to print yesterday\n";
34 system("cat $newfile >> $savefile");
36 system("mv $newfile $savefile");
42 open(OUT, "lpr -P$printer -h $savefile|");
46 if ($msg eq "Printer queue is disabled.") {