Sometimes on AIX, you really want to intercept a print job before it starts burning through toner and paper. Maybe you'd like to look at the print file on the screen before it comes out in a hard copy. Or perhaps you'd like to take a copy and edit it, tidy up its formatting, and make sure it lines up with preprinted stationery. You can do all this by disabling the AIX print queue; that lets you view the print job before it gets to the physical printer.
Temporary Print File
The default behavior when you print from AIX is to create a temporary file, which will go to the directory /var/spool/qdaemon. (Incidentally, if you're printing large jobs, you always want to make sure you have enough spare space in the /var file system.) Because printing can happen so quickly, the job can go in and out of the queue before you notice. If you want to see the print job, or make sure that it’s going to the queue you thought it was going to, you can put the print queue on hold using the disable command.
First, you have to know the print queue name. The lpstat command will report print queue names and their status. However, lpstat without any flags will display only the first seven characters of the print queue name, which won't be much help if you need to disable the print queue. To view the full print queue name, use the -W flag for lpstat:
Queue Dev Status Job Files User PP % Blks Cp Rnk
------------ ----------- ------ ---- ----- ---- -- - ---- -- ---
ho_reception hp@horecept READY
Suppose you have a queue in the Head Office for reception. Now that you have a queue name, you can disable it using the—you guessed it!—disable command:
This disables a single queue, but disabling this queue won’t stop users from printing to other printers. And because this is only the queue on this AIX VM, you could still print to the same physical printer from other operating systems. So think of the disable command as a “pause” button just for this queue on this AIX VM.
Now if you send a print job to the print queue, the queue should be listed as DOWN, and the job will be sitting in the queue.
You should find a temporary file in /var/spool/qdaemon. It won't have a very instructive name because it's just a temporary file, so you could list the temporary file using lpstat -t, or simply list files in order of their modification using the following command:
If you have thousands of print files, you can try using the find command with the -mmin flag. This lets you list files that have been changed in the past few minutes. For example, this command will provide a long list (similar to ls -l) of any temporary print files that have been written to in the past three minutes.
You can make a copy of the temporary print file and edit that copy. The edited file can then be sent to the print queue. If that’s going to create two copies and waste paper, you can always cancel the print job sitting in the queue using the cancel command. To do so, you'll need to use the print job number that appeared in the lpstat command:
To cancel all jobs for a print queue, use the print queue name instead of the job number.
You can restart the queue using the enable command:
This should start printing any jobs that are in the queue.
A Handy Skill
With so many applications that allow you to print from a Windows client, setting up and managing AIX print queues is a bit of a lost art. Still, if you need to do some troubleshooting or editing of temporary print files, and for some reason you can't go back to the source, bringing queues down and up again can come in handy.