Automatically dispatch your print jobs to CETS.
Python Shell
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


What this is

This is a script that is meant to run in the background on your eniac account. It will constantly poll a specific directory which you can provide, for PDF files to print. It will split the PDF files in chunks of 10 pages (5 pages double sided) to be printed to CETS every half-hour.

This lets you drop PDFs into the folder using your favorite FTP client or w/e and not have to worry about logging in to eniac to get the job printed. It also lets you print large jobs over time while abiding by the CETS printing policy.


You use this at your own risk. I take no responsibility for whatever happens. I do not claim that CETS is happy with this.

This script is not bulletproof in any way. Silly things will definitely result in its termination, like not being able to open a file, or anything else that fires a Python Exception. I don’t care about this but feel free to harden it if you do.

Automatic Setup

Run the following commands in terminal while logged in to eniac. You can just copy it into terminal and hit enter. After running screen, press enter or space to get your prompt again.

$ screen
$ curl -L | sh

You will then be able to add files to the directory to_print in your home directory for automatic printer dispatch. You can now stop reading this manual and enjoy this new feature until it breaks and you don’t know why.

Manual Setup

Eniac has pyPdf installed by default. In case you run into a problem where it doesn’t, follow the directions below, otherwise just skip to setting up your script vars and executing the script below.

  • Augment PYTHONPATH to include ~~/lib/python~

    This will allow easy_install to write to that location. If that dir doesn’t exist then create it. Add the following to your .bashrc:

    export PYTHONPATH=~/lib/python:$PYTHONPATH
  • install pyPdf
    >> easy_install -d ~/lib/python pyPdf

Script Variables

There are some variables in the script you should edit to match your own setup. These are :

The path to your home directory.
Where you’d like the process to log to. Default is in your path_to_watch directory.
This is the full path to the directory in which you will place your PDFs for printing. It must exist.
How frequently you’d like this script to poll your printing directory for new documents. The default is 10 seconds.
How many pages you’re willing to go over the 5 page policy limit.

How to use

Run a screen session, and have this script running within it indefinitely. Since we don’t have the authority to create daemons on Eniac, this is our next best option. Screen lets you run shell sessions for arbitrary amounts of time across different login sessions.

>> screen
>> ./autoprint &

Then detach from the screen with <CTRL>-A D.

Moving files to Eniac

  • If you’re using a Mac, this is a fantastic solution for mounting your eniac directory directly within Finder:


If you want to check on the status of your print jobs, perhaps something is fishy and you expected them to be done by now, look at the log file autoprint.log for details on what happened last.

Script description

Watch for directory updates

We’ll check the directory for new files whenever we are ready to release a new print job, since we are restricted by that anyway. So we’ll need a queue of jobs.

Process new files

For each file: Split it into multiple files if it is greater than 10 pages. Add those files to the queue.

Release print jobs

For each file in the queue (referenced by filename), release to printer at print interval.

Delete files once they have been processed


Special label for urgent files to be printed

This would be cool; if a filename starts with URG or something similar, the script puts precedence on it and that file gets printed first.

Current bugs/improvements

Avoiding incomplete files

The script currently has no way of finding out whether a file is done being copied or not. As a result, it will prematurely try to process a file even if that file is not “ready” yet, and will ultimately fail and perhaps crash.

This can be fixed with inotify.