UNIX System Administration Handbook - Evi Nemeth [421]
abort printer
abort is just like stop, but it doesn’t allow the active job to complete. When printing is reenabled, this job will be printed again.
down printer message
up printer
These commands affect both spooling and printing. Use them when a printer is really broken or has to be taken off-line for an extended period. The message parameter supplied to down can be as long as you like (on one line) and need not be quoted; it will be put in the printer’s /var/spool/lpd/printer/status file and shown to users who run lpq. You’ll normally want to use this feature to register a short explanation of why the printer is unavailable and when it will be back in service. The up command reverses the effect of a down.
clean printer
This command removes all jobs from the printer’s queue, including the active job. Because the printing daemon for the queue will still hold references to the files of the current job, UNIX will not really delete them and the current job will complete.
topq printer jobid
topq printer username
The first form moves the specified job to the top of the printer’s queue. The second form promotes all jobs belonging to username.
restart printer
The restart command restarts a printing daemon that has mysteriously died. You’ll know that the daemon is dead when lpq tells you “no daemon present.” Although you might think restart would have the same effect as a stop followed by a start, it does not; restart will fail to restart a printer that still has a filter running.
status printer
The status command shows you four things about a printer: whether spooling is enabled, whether printing is enabled, the number of entries in the queue, and the status of the daemon for that printer. If no entries are in the queue, you’ll see something like this:
lpc< status cer
cer:
queuing is enabled
printing is enabled
no entries
no daemon present
The fact that no daemon is present is not a cause for concern; printer-specific daemons go away after the queue is empty and aren’t restarted by the master copy of lpd until another job is spooled.
The /etc/printcap file
/etc/printcap is the BSD printing system’s master database. It contains information necessary for printing to local and remote printers. A printer must be described in the printcap file before jobs can be submitted to it.
/etc/printcap uses the same format as /etc/termcap and /etc/remote. The first item in each entry is a list of names for the printer, separated by vertical bars. The names are followed by a number of configuration settings separated by colons. Configuration options are of the form xx, xx=string, or xx#number, where xx is the two-character name of a parameter and string and number are values to be assigned to it. When no value is assigned, the variable is Boolean and its presence indicates “true.”
The null statement is acceptable, so you can place two colons side by side. It is helpful to begin and end each line with a colon to make subsequent modifications easier. Comments in /etc/printcap start with a pound sign (#). Entries can span several lines if intermediate lines are terminated with a backslash. Continuation lines are, by convention, indented.
The syntax of the printcap file is illustrated in the following example, which defines a remote printer attached to the machine anchor:
# HP LaserJet 5M remote printcap. CS Department.
anchor-lj|cer|1-56|LaserJet 5M in cer lab:\
:lp=/var/spool/lpd/anchor-lj/.null:\
:sd=/var/spool/lpd/anchor-lj:\
:lf=/var/adm/lpd-errs:\
:rw:mx#0:rm=anchor:rp=anchor-lj:
From the first line, we can see that “cer”, “anchor-lj”, “1-56” and “LaserJet 5M in cer lab” are all equivalent names for the same printer. These names are the printer’s given name, a well-known abreviation, the room number of the printer’s location, and a full description. Although you can give your printers as many names as you like, you should include at least three