The UNIX system print service is a collection of utilities that help you, as system administrator (or printer administrator), to configure, monitor, and control the printers on your system.
The print service:
When a user sends a file to a printer, the print service assigns to the request (print job) a unique name, the request ID.
The request ID consists of the name of the printer on which the file is to be printed and a unique number identifying the file. Use this request ID to find out the status of the print job or to cancel the print job. The print service keeps track of all the print requests in the request log.
The print job is spooled, or lined up, with other print jobs to be sent to a printer. Each print job is processed and waits its turn in line to be printed. This line of pending print jobs is called a print queue.
Each printer has its own queue; you can hold jobs in the queue, move jobs up in a queue, or transfer jobs to another queue.
The following figure provides an overview of the processing of a print request.
Figure 6-1. Overview of Print Request Processing
Each print request is sent to a spooling daemon (background program) that keeps track of all the jobs. (This information is archived in the request log.) The daemon is created when you start the print service. The spooling daemon is also responsible for keeping track of the status of the printers and slow filters; when a printer finishes printing a job, the daemon starts it printing another job if one is queued.
You can customize the print service by adjusting or replacing some of the items shown in the Overview of Print Request Processing figure (the numbers are keyed to the diagram).
For instance, if the terminfo database does not show a printer capable of setting a page length requested by a user, the spooling daemon rejects the request. However, if it does show it to be capable, then the interface program uses the same information to initialize the printer.
Each time a user sends a job to the printer, the print service creates two files that describe the job request and places one each in the /usr/spool/lp/temp and /usr/spool/lp/requests directories. The information about the job is split into two files so that the system can keep sensitive information secure in the /usr/spool/lp/requests directory. The user who submitted the job has access to the request file in /usr/spool/lp/temp; only the printer administrator (or root user) has access to the file in /usr/spool/lp/requests.
The request files remain in these directories only while the job is in the queue. When the job finishes printing, the information in the two files is combined and appended to the request log, /usr/spool/lp/logs/requests.
The structure of the request log makes it easy to extract data using common UNIX shell commands. The requests are listed in the order in which they were printed, separated by lines that begin with the request ID. Each line below the separator line is marked with a single letter, the request log code, that identifies the kind of information contained in the line. Each letter is separated from the data by a single space. The table following the sample entry describes these codes.
Following is a sample entry from the print request log:
= ps-717, uid 1532, gid 18, size 7872, Tue May 10 14:43:10 1994 z ps C 1 D ps F /usr/spool/lp/temp/717-1 P 20 t simple U hanna s 0x0010
Letter | Content of line |
---|---|
= | The separator line lists the (comma-separated) request ID, user ID (uid), and group ID (gid) of the user who submitted the request, total number of bytes in the original (unfiltered) file (size), and the date and time the request was queued. |
C | Number of copies printed. |
D | Printer or class destination or the word any. |
F | Name of the file in the /usr/spool/lp/temp directory. This line is repeated for each file printed, and files are printed in the order given. |
f | Form name used (if applicable). |
H | Type of special handling used:
|
N | How the print service notified the user after printing the file (if
applicable):
|
O | Any -o options given to the lp command. |
P | Priority of the print request, if applicable. |
p | List of pages printed. |
r | Any -r options given to the lp command indicating that the user requested raw processing of the file. |
S | Character set used. |
s | Outcome of the job, expressed as a combination of individual bits in
hexadecimal form. The important bits used internally by the spooler
are:
|
T | Title on the banner page. |
t | Content type of the file. |
U | Name of the user who submitted the print request. |
x | Slow filter. |
Y | List of special modes to give to the filters used to print the request. |
y | Fast filter. |
z | Printer used for the request. This differs from the destination (the D line) if the request was queued for any printer or a class of printers, or if the printer administrator transferred the request to another printer. |
In general, you should use Web-based System Manager to manage your print service. However, if you need to manage your print service from the command line, refer to these articles:
Command | Description |
---|---|
cancel | Cancels a request for a file to be printed |
lp | Sends a file or files to a printer |
lpstat | Reports the status of the print service |
The administrator can give users the ability to disable and enable a printer so that if a printer is malfunctioning, the user can turn the printer off without having to call the administrator. (However, in your printing environment, it might not be reasonable to allow regular users to disable a printer.)
The Administrative Print Service Commands Table lists print service commands available only to the administrator. To use the administrative commands, you must be logged in as root user.
The administrative print service commands are located in the /usr/lib directory. If you use these commands frequently, include /usr/lib in your PATH variable.
Command | Description |
---|---|
accept
reject | Permits jobs to be queued for a specified destination
Prevents jobs from being queued for a specified destination |
cancel | Cancels requests to a line printer |
enable
disable | Activates the named printers |
lpadmin | Sets up or changes printer configurations |
lpc | Provides (BSD) line printer control |
lpfilter | Sets up or changes filter definitions |
lpforms | Sets up or changes preprinted forms (use /usr/sbin/lpadmin to mount a form) |
lpmove | Moves output requests from one destination to another |
lpsched
lpshut | Starts the print service
Stops the print service |
lpsystem | Registers remote systems with the print service |
lpusers | Sets or changes the default priority and priority limits that the users of the print service can request |
The accept, reject, cancel, enable, disable, and lpadmin commands can also be run from the Web-based System Manager interface. To run these commands, start Web-based System Manager, then select the Printers plug-in from the Contents Area.