Clearing Stopped Mac Print Queues (automatically, using scripts)

After a printer error like a paper jam or a communication problem a Mac print queue may need to be manually started before jobs start printing again. The same can be true if a "bad" job is encountered - the other jobs won't print until it is cleared.

Steve from Gustavus Adolphus College contributed the following scripts to start stopped queues and clear stopped jobs. These scripts are for Mac OS 10.5 (Leopard) Server. Other versions or non-server editions may require different commands or arguments.

First thing I need to do was make sure my queues were resumed. It can be done with this command. I run this as a launchd daemon every 2 minutes:
/usr/sbin/cupsenable `lpstat -p | grep 'disabled' | awk '{print $2}'`
This will resume the queue and leave the bad job "stopped" - basically the queue resumes and just skips over this job.
To clear the "stopped" jobs I run the following launchd daemon at night when the printers aren't being used:
/usr/bin/cancel -a `lpstat -p | awk '{print $2}'`
launchd is actually what is used to set the time interval. A user can easily do this with a program called Lingon and set it to any amount of time or they can write a launchd script.

keywords: cupsd, cups, pause, paused


Categories: Scripting

Page last modified on March 30, 2009, at 07:11 AM