Module 82 lprm (BSD)

Previous Table of Contents Next


Module 82
lprm (BSD)

DESCRIPTION

The external lprm command removes print jobs from a printer s spool queue. The spool queue is a system controlled directory and normal users cannot directly manipulate the files within the queue. Therefore, to remove a print job you must use the lprm command.

By default lprm , without options or arguments, removes the currently active print job, assuming the user running lprm owns the active print job. If you specify a print job number, lprm only removes that specific print job.

The names of all print jobs removed from the queue are displayed to your screen. If no print jobs are removed, no message is returned.

When the super-user specifies a user_name , all jobs belonging to that user are removed from the print queue.

COMMAND FORMAT

Following is the general format of the lprm command.

 lprm [ -Pprinter ] [ - ] [ job# ] [ username ... ] 

Options

The following list describes the options and their arguments that may be used to control how lprm functions.

-P printer Specify the printer queue for a certain physical printer. If you do not specify this option, the value of the PRINTER variable is used as the print queue. If PRINTER is not set, then the print queue for the default printer is used.
- Remove all jobs owned by you. If you are the super-user, all jobs are removed from the specified queue.

Arguments

The following list describes the arguments that may be passed to the lprm command.

job# The number of the print job to remove, which is currently spooled in a print queue
username The name of the user whose print jobs are removed. Only the super-user can specify a different username .

DIAGNOSTICS AND BUGS

If you receive the following message when using lprm , contact your system administrator.

 lprm: printer: cannot restart printer daemon 

This message indicates that the lpd on your system is not working properly or has failed. This usually requires the system administrator to terminate the printer daemon and restart it or, if it has failed, just restart it.

Depending on printer and system speeds, you may perform an lprm that removes the second job in queue by accident . This condition occurs when you have spooled two or more jobs in the print queue back to back. You want to remove the active print job. You run lpq to identify the active job; you run lprm to remove the job. When you check again, the first two jobs appear to be removed. What actually happened was the first job printed and your lprm command removed the second job, which became active. To prevent this from occurring, specify the job# you want to remove.

RELATED COMMANDS

Refer to the lpq and lpr commands described in modules 80 and 81. @H2 = RELATED FILES The lprm command accesses the following files to perform the requests .

/etc/printcap Printer characteristics database.
/usr/spool/* Location of printer spooling directories.
/usr/spool/l*/lock Lock file containing the current daemons PID and the active print job number.

APPLICATIONS

The lprm command provides you with the ability to remove print jobs you have decided you no longer need printed, thus saving paper and time for yourself and other users.

TYPICAL OPERATION

In this activity you use the lprm command to remove a print job. Begin at the shell prompt.

1.    First type lpr/etc/passwd ; lpq and press Return to queue a job to the default printer and display the queue information. The output from the lpq command appears as follows .
 cj> lpq      lj is ready and printing      Rank    Owner      Job  Files                 Total Size      active  mylogin    295  /etc/passwd           5938 bytes 
2.    Now remove the job by typing lprm 295 and pressing Return . The job will be removed and a message will notify you of the fact. If you are using a very fast printer (1000 lines per minute), the job may print before you have time to remove it. If the job is removed the output of lprm resembles the following.
 cj> lprm 295      dfA295cj dequeued      cfA295cj dequeued 
3.     Turn to Module 80 to continue the learning sequence.


Previous Table of Contents Next

Copyright Wordware Publishing, Inc.


Illustrated UNIX System V
Illustrated Unix System V/Bsd
ISBN: 1556221878
EAN: 2147483647
Year: N/A
Pages: 144
Authors: Robert Felps

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