to Print

The last mile

Joe Montibello, MLIS
Library Systems Manager
Dartmouth College Library

What we'll cover: 




Circulation Situation

What do I mean by the last mile?

Dartmouth College

~7,000 students (graduate and undergrad)

Innovative Interfaces Inc. - Millennium ILS

locally hosted  / root access to the server

3 "Real Programmers" in the library

Everything about me that fits on a slide:

Systems Librarian

Limited Unix background

No programming background =>

Love to make systems work for users (patrons and/or staff) 

Circulation Situation

Six branches that regularly circulate materials

Eight circulation desks, each sending notices 

Most notices go via email, a few are mailed

Staff went into the system each day to tell the system to send notices...manually?

"please returneth the digital camera posthaste"

There's an app for that

System provides autonotice functions, but the feature hadn't been turned on

Previous implementation history

The problem: the system won't handle printing notices automatically.

Last Mile Problem

connections from the backbone of a network to the end users are the "most expensive part of the system...[and] the most difficult to upgrade" 

The network can't be considered a success until it bridges the last mile

Autonotices isn't a success if you still have to check for and print some notices manually


Pick up the files and convert them to pdfs

Email them to the circulation desk that created them

Bonus points: Email the autonotice log to the system administrator (me) to check on any errors reported

A little more detail

Make sure the filenames are readily parseable

Iterate through the files in the directory

read the first six characters and use that to determine which circ desk sent the notice job (and therefore, which email address to send to)

convert the file to pdf

attach the file to an email

Proof of Concept

I don't want to be a programmer, but I need to speak their language

Writing the code using the toolkit I have at hand (UNIX command line) will be useful experience

...and I won't be taking up the programmer's time until I know that the goal is feasible
$ cat autoprintdata


A text file with the codes and addresses in it


# autoprintctl
# This script lists the filenames in the /iiidb/marc directory
# that include ".autonotices.p" in them and runs the script 
# "autoprintjob" against each. But first, email the autonotices# log so that it gets seen regularly.

The attached file is an autonotices log. This file is kept on the Millennium server, so you don't need to keep copies.\
If you have any questions or problems, please contact ...

echo $text | mutt -s Autonotices -a /iiidb/errlog/autonotices.log 

ls /iiidb/circ/autonotices | grep *.autonotices.p  | xargs 

So for each file, we're going to run the following code:

$ cat autoprintjob
set -x
set -e

# autoprint
# This program accepts a series of filenames (separated by 
# spaces) from stdin, converts the text to pdf, and emails the
# resulting files to a user. This was designed to work with 
# autoprintctl, for notices found in iiidb/marc/ on olympia.

email="global variable"

Set up variables

function getemail
#checks the first six characters of the input name against a 
#table of codes and the corresponding email addresses for the #circulation points that will get the notices.
 inputcode=` echo $1 | cut -c 1-6 `
 while read line ; do
	if [ "$inputcode" = "$checkcode" ]; then

Function to get the email address if a given line matches an address

#in this loop, we convert each file to pdf and send it 
while (( "$#" )); do
	getemail $1
	# create from the III-generated print file
	enscript -q --margins=::10: -L 60 -B -p "${noticedir}/" "${noticedir}/$1"
	# make a string named the same as $1, but with .pdf 
	#echo $outfile	

	# convert to $1.pdf
	ps2pdfwr ${noticedir}/ ${noticedir}/$outfile

	# now, send the email.
	echo "This is a test of autoprintjob, sending copies to Joe." | mutt -a "${noticedir}/$outfile" -s "To = $email"
	echo "These are the printed autonotices." | mutt -a "${noticedir}/$outfile" -s "$outfile" "$email"
#clean up - for now, we'll move them.  Maybe later, clear them?
	mv ${noticedir}/ ${noticedir}/sent/
	mv ${noticedir}/$outfile ${noticedir}/sent/$outfile
	mv ${noticedir}/$1 ${noticedir}/sent/$1  

	#now, move onto the next print file

Move the files out of the directory so they won't get mixed in the next time this runs

It worked, but...

Reality check - remember, I wrote this.

  • No error handling

  • Code/email combinations are in a random file

  • Depends on a number of different shell tools, any one of which could break my script when they get upgraded

The hand-off

A programmer took my script and rewrote it:

  • In a language that our department has depth in
  • In one self-contained script
  • With error-handling
  • With email addresses mapped from login names instead of an arbitrary coding system
  • Log file doesn't get sent all together - it only sends mail with relevant error messages

Where are they now?

Notices are sent out multiple times per day, with any that need to be printed being run through this process and winding up in the inbox of the interested party

Staff at those 8 circulation desks don't "send notices" anymore, it just happens

Errors in autonotices log are seen immediately


You can write a program that works, even if you need some help

Another Conclusion

Prototyping is an effective communication tool


Eric Bivona - Programmer
Lynn Amber - Access Services Librarian



Joe Montibello

autonotices to print

By joemontibello

autonotices to print

  • 1,553
Loading comments...

More from joemontibello