Online Book Reader

Home Category

UNIX System Administration Handbook - Evi Nemeth [420]

By Root 2952 0
number for each job; this number is important to know if you intend to manipulate the job later with lprm or lpc. The fourth column shows the filenames that were listed on the lpr command line used to spool the job. If the data came in via a pipe (as the first and fifth jobs did above), the entry in this column will be standard input. The fifth and final column tells you the size of the job. This number is the size of the job before it is sent to the filter program and gives no information about how many pages a job will be or how long it will take to print.

lprm: remove print jobs


The most common form of lprm is lprm jobid, where jobid is the job identification number reported by lpq. lprm user removes all jobs belonging to user. lprm without arguments removes the active job. lprm - removes all the jobs you submitted; if you are root, it removes every job in the queue. No ordinary user can remove another user’s jobs, but the superuser can remove any job.

Perversely, lprm fails silently but produces output on success. If you don’t see output that looks like

dfA621xinet dequeued

cfA621xinet dequeued

after running lprm, it means you did not invoke the command correctly.

The printing system maintains a notion of the origin of a job as well as the user who spooled it, and lprm’s matching process takes both into account. Thus garth@sigi is not equivalent to garth@boulder, and neither can remove the other’s jobs.

Trying to lprm the active job can cause problems on some printers. The filter process for the job is not properly notified of the termination, causing the whole system to come to a grinding halt with the filter process holding an exclusive lock on the printer’s port and preventing other processes from using the printer.

The only way to fix this situation is to use ps to identify the filter processes and kill them off by hand. lpc is not of use in this situation. Rebooting the system will always cure a hung printer, but this is a drastic measure. Before you resort to a reboot, kill and restart the master copy of lpd and manually remove jobs from the spool directory with the rm command.

lpc: make administrative changes


The lpc command can perform the following functions:

• Enable or disable queuing for a particular printer

• Enable or disable printing on a particular printer

• Remove all jobs from a printer’s queue

• Move a job to the top of a printer’s queue

• Start, stop, or restart the lpd daemon

• Get printer status information

When the printing system is running smoothly, lpc works just fine. But as soon as a filter gets stuck or some other minor problem appears, lpc wigs out completely. And it lies: it sometimes claims to have fixed everything when in reality, it has done nothing at all. You may have to fix things up by hand or even power-cycle your equipment when printing gets badly snarled.

lpc cannot be used across a network; you must log into the machine that owns the printer you want to manipulate. lpc is normally used interactively, although you can also invoke it in a one-shot mode by putting one of the interactive commands on lpc’s command line. Once you have activated lpc, the various commands described below are available:

help [command]

help without arguments shows you a short list of all available lpc commands. With an argument, it shows a one-line description of a particular command.

enable printer

disable printer

These commands enable or disable spooling of jobs to the named printer. Users who attempt to queue files are politely informed that spooling has been disabled. Jobs that are already in the queue are not affected. You perform this operation by simply setting or clearing group execute permission on /var/spool/lpd/printer/lock.

start printer

stop printer

start enables and stop disables printing on the named printer. Print jobs can still be spooled when a printer has been stopped, but they will not be printed until printing is restarted. start and stop operate by setting or clearing owner execute permission on /var/spool/lpd/printer/lock.

Return Main Page Previous Page Next Page

®Online Book Reader