Removing Jobs from the Queue with the lprm Command


Removing Jobs from the Queue with the lprm Command

The lprm command can be used to remove print jobs that are currently in the queue and sometimes to remove print jobs that are currently printing. If lprm is run without any command-line arguments, it will remove whatever job is currently printing on the default printer if that job belongs to the user running lprm. If the currently running job does not belong to the user running lprm, the command will have no effect. If the root user runs lprm with no options, the command will remove the currently printing job from the default printer, no matter who the job belongs to.

Running lprm with a job number as an argument will remove the job with that ID number from the queue of the default printer, assuming that you own the job and that you are not the root user. Normal users can only remove jobs that belong to them. The root user can remove any job. Use lpq (as described in the previous section) to determine a job's ID, which you can then feed to lprm. Here is an example:

# lprm 5 dfA001simba.example.com dequeued cfA001simba.example.com dequeued


This command "dequeues" (removes from the queue) two files associated with job ID 5: the spooled copy of the file (beginning with dfA001), and a control file. When both these files have been deleted, the print job stops, and any data not yet spooled to the printer is discarded.

Note

The system may take some time to respond when you run lprm (up to several seconds). It may seem that lprm has hung. Don't worry; it hasn't. Wait a few seconds, and you should get your prompt back.


If you try to delete a job that does not belong to you, and you are not the root user, lprm will respond with the message Permission denied.

The lprm command has a few options to modify the default behavior. These are listed in Table 17.5.

Table 17.5. Options to lprm

Option

Description

-P name

Here, name is the name of the printer that lprm should remove the job from. If the printer name is not specified, the default printer specified in the PRINTER environment variable is used. If the PRINTER environment variable is not set, the default printer aliased to lp is used.

-

A dash by itself will cause all jobs belonging to you to be removed from the queue. If you are the root user, all jobs in the queue will be removed.

user

Here, user is the username of someone on the system. This option will remove all jobs belonging to that user. This works only for the root user because normal users can only remove jobs belonging to themselves.


Caution

Removing a job that is currently printing will not cause the printer to stop immediately. Depending on the amount of RAM installed in your printer, there could be up to several pages of data already in the printer's buffer. This means that some of the document could be printed anyway (or if the document is small enough, almost the entire document could be printed), even if it has been removed from the queue.


Note

Print jobs can be removed only from the system they were sent from, even if the printer is available to more than one computer on the network.





FreeBSD 6 Unleashed
FreeBSD 6 Unleashed
ISBN: 0672328755
EAN: 2147483647
Year: 2006
Pages: 355
Authors: Brian Tiemann

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net