This section describes the directory structure, files, and logs of the LP print service.
The LP Print Service client commands have been modified to be a consumer of the FSG OpenPrinting Open Standard Print API (PAPI). These print commands are layered on top of the PAPI. See How the PAPI Is Implemented in the Oracle Solaris OS for more information.
The following table lists frequently used LP print service commands.
Table 12–2 LP Print Service Commands
Command |
Task |
Man Page |
---|---|---|
enable |
Activate a printer | |
cancel |
Cancel a print request | |
lp |
Send one or more file or files to a printer | |
lpstat |
Report the status of the LP print service | |
disable |
Deactivate on or more printers | |
accept |
Permit print requests to be queued for a specific destination | |
reject |
Prevent print requests from being queued for a specific destination | |
lpadmin |
Set up or change a printer configuration | |
lpfilter |
Set up or change filter definitions | |
lpforms |
Set up or change preprinted forms | |
lpadmin |
Mount a form | |
lpmove |
Move output requests from one destination to another destination | |
lpsched |
Start the LP print service scheduler | |
lpshut |
Stop the LP print service scheduler | |
lpusers |
Set or change the default priority and priority limits that can be requested of the LP print service by users |
For information about print commands that have been modified for use with the PAPI, see How the PAPI Is Implemented in the Oracle Solaris OS.
The LP print service performs the following functions:
Administers files and schedules local print requests
Receives and schedules network requests
Filters files, if necessary, so they print properly
Starts programs that interface with the printers
Tracks the status of print jobs
Tracks forms that are mounted on the printer
Tracks print wheels that are currently mounted
Delivers alerts to mount new forms or different print wheels
Delivers alerts about printing problems
The /usr/lib/lp directory contains daemons and files used by the LP print service, as described in the following table.
Table 12–3 Contents of the /usr/lib/lp Directory
File |
Type |
Description |
---|---|---|
bin |
Directory |
Contains files for generating printing alerts, slow filters, and queue management programs. |
model |
Directory |
Contains the standard printer interface program. |
postscript |
Directory |
Contains all PostScript filter programs provided by the LP print service. These filters come with descriptor files in the /etc/lp/fd directory. These files tell the LP print service the characteristics of the filters and where to locate them. |
The files of the LP print service are distributed among the directories that are shown in the following table.
Table 12–4 Directories for the LP Print Service
Directory |
Contents |
---|---|
/usr/bin |
The LP print service user commands. |
/etc/lp |
A hierarchy of LP server configuration files. |
/usr/share/lib |
The terminfo database directory. |
/usr/lib/print |
The lp conversion scripts, in.lpd daemon, and the printd daemon. The printd daemon transfers all pending jobs in the/var/spool/print directory once per minute. When no jobs are remaining to transfer, the printd daemon exits. |
/usr/sbin |
The LP print service administrative commands. |
/usr/lib/lp |
The lpsched program, binary files, PostScript filters, and the model directory, which contains the standard printer interface program. |
/var/lp/logs |
LP log files such as lpsched.n (which includes messages from lpsched) and requests.n (which includes information about completed print requests). |
/var/spool/lp |
The spooling directory where files are queued for printing. |
/var/spool/print |
The staging area for LP print service client-side requests. |
/etc/lp/model/uri |
The location of the interface script that process device-uri information. |
The lpsched daemon stores configuration information in the /etc/lp directory, as described in the following table.
The configuration files listed in this table are private interfaces. These files are subject to change in future releases. You should not build software that relies on these files being in their current locations or that relies on the data being in the format currently used.
File |
Type |
Description |
---|---|---|
classes |
Directory |
Files identifying classes provided by the lpadmin -c command. |
fd |
Directory |
Description of existing filters. |
filter.table |
File |
Print filter look-up table. |
forms |
Directory |
Location to put files for each form. Initially, this directory is empty. |
interfaces |
Directory |
Printer interface program files. |
logs |
Link to /var/lp/logs |
Log files of printing activities. |
model |
Link to /usr/lib/lp/model |
The standard printer interface program. |
printers |
Directory |
Directories for each local printer. Each directory contains configuration information and alert files for an individual printer. |
pwheels |
Directory |
Print wheel files or cartridge files. |
ppd |
Directory |
Each local queue that is configured with a PPD file has a copy of the PPD file placed here. |
These configuration files serve a function similar to the /etc/printcap file on LPD-based print servers.
You can check the contents of the configuration files, but you should not edit these files directly. Instead, use the lpadmin command to make configuration changes. Your changes are written to the configuration files in the /etc/lp directory. The lpsched daemon administers and updates the configuration files.
The /etc/lp/printers directory has a subdirectory for each local printer that is known to the system. The following example shows the /etc/lp/printers subdirectories of printers sparc1 and luna.
$ ls -l /etc/lp/printers drwxrwxr-x 2 lp lp 512 Jan 23 23:53 luna drwxrwxr-x 2 lp lp 512 Jan 11 17:50 sparc1 |
The following table describes the files within each printer-specific directory.
File Name |
Description |
---|---|
alert.sh |
Shell to execute in response to alerts |
alert.vars |
Alert variables |
configuration |
Configuration file |
users.deny |
List of users to whom printer access is denied |
comment |
Printer description |
The configuration file for the printer luna, /etc/lp/printers/luna/configuration, would typically appear as follows:
Banner: on: Always Content types: PS Device: /dev/term/b Interface: /usr/lib/lp/model/standard Printer type: PS Modules: default |
The /usr/share/lib directory contains the terminfo database directory. This directory contains definitions for many types of terminals and printers. The LP print service uses information in the terminfo database to perform the following tasks:
Initializes a printer
Establishes a selected page size, character pitch, line pitch, and character set
Communicates the sequence of codes to a printer
Each printer is identified in the terminfo database with a short name. If necessary, you can add entries to the terminfo database, but doing so is tedious and time-consuming. For more information, see Adding a terminfo Entry for an Unsupported Printer.
Information about each printer type is stored in the terminfo database (/usr/share/lib/terminfo). This information includes the printer capabilities and initialization control data. The printer you install must correspond to an entry in the terminfo database.
$ pwd /usr/share/lib/terminfo $ ls 1 3 5 7 9 B H P a c e g i k m o q s u w y 2 4 6 8 A G M S b d f h j l n p r t v x z $ |
Each subdirectory contains compiled database entries for terminals or printers. The entries are organized by the first letter of the printer or terminal type. For example, if you have an Epson printer, look in the /usr/share/lib/terminfo/e directory to find your particular model of Epson printer.
$ cd /usr/share/lib/terminfo/e $ ls emots ep2500+high ep48 ergo4000 exidy2500 env230 ep2500+low epson2500 esprit envision230 ep40 epson2500-80 ethernet ep2500+basic ep4000 epson2500-hi ex3000 ep2500+color ep4080 epson2500-hi80 exidy $ |
The entries for Epson printers begin with epson.
If you have an NEC printer, look in the /usr/share/lib/terminfo/n directory for your NEC printer model.
$ cd /usr/share/lib/terminfo/n $ ls ncr7900 ncr7900iv netronics network nuc ncr7900-na ncr7901 netty netx nucterm ncr7900i nec netty-Tabs newhp ncr7900i-na net netty-vi newhpkeyboard $ |
The nec entry in this directory is for the NEC printer.
The following three tables list the terminfo items that are required for a printer.
Table 12–6 Required terminfo Items for a Printer (Booleans)
Item |
|
Description |
---|---|---|
Booleans: |
|
|
|
cpix |
Changing character pitch changes resolution |
|
daisy |
Printer requires an operator to change character set |
|
lpix |
Changing line pitch changes resolution |
Table 12–7 Required terminfo Items for a Printer (Numbers)
Item |
|
Description |
---|---|---|
Numbers: |
|
|
|
bufsx |
Number of bytes buffered before printing |
|
cols |
Number of columns in a line |
|
cps |
Average print rate in characters per second |
|
it |
Tabs initially every n spaces |
|
lines |
Number of lines on a page |
|
orc |
Horizontal resolution, in units per character |
|
orhi |
Horizontal resolution, in units per inch |
|
orl |
Vertical resolution, in units per line |
|
orvi |
Vertical resolution, in units per inch |
Table 12–8 Required terminfo Items for a Printer (Strings)
Item |
|
Description |
---|---|---|
Strings: |
|
|
|
chr |
Changes horizontal resolution |
|
cpi |
Changes number of characters per inch |
|
cr |
Carriage return |
|
csnm |
List of character set names |
|
cudl |
Moves carriage down one line |
|
cud |
Moves carriage down n lines |
|
cuf |
Moves carriage to the right n columns |
|
cvr |
Changes vertical resolution |
|
ff |
Ejects page |
|
hpa |
Horizontal position absolute |
|
ht |
Tabs to next 8-space tab stop |
|
if |
Is the name of initialization file |
|
iprog |
Is the path name of initialization program |
|
is1 |
Is a printer initialization string |
|
is2 |
Is a printer initialization string |
|
is3 |
Is a printer initialization string |
|
lpi |
Changes number of lines per inch |
|
mgc |
Clears all margins (top, bottom, and sides) |
|
rep |
Repeats a character n times |
|
rwidm |
Disables double-wide printing |
|
scs |
Selects character set |
|
scsd |
Starts definition of a character set |
|
slines |
Set page length to n lines per page |
|
smgl |
Sets left margin at current column |
|
smglp |
Set left margin |
|
smgr |
Sets right margin at current column |
|
smgrp |
Sets right margin |
|
smglr |
Sets both left and right margins |
|
msgt |
Sets top margin at current line |
|
smgtp |
Sets top margin |
|
smgb |
Sets bottom margin at current line |
|
smgbp |
Sets bottom margin |
|
smgtb |
Sets both top and bottom margins |
|
swidm |
Enables double-wide printing |
|
vpa |
Sets vertical position to absolute |
The LP print service maintains two sets of log files that are described in the following table.
Log File Name |
Description |
---|---|
syslogd |
Set lpr.debug in /etc/syslog.conf to enable LP print service logging |
/var/spool/lp |
A list of current requests that are in the print queue |
/var/lp/logs/requests |
An ongoing history of print requests |
The scheduler for each system keeps a log of print requests in the /var/spool/lp/tmp/system and /var/spool/lp/requests/system directories. Each print request has two files, one file in each directory, that contain information about the request. The information in the /var/spool/lp/requests/system directory can be accessed only by superuser or lp. The information in the /var/spool/lp/tmp/system directory can be accessed only by the user who submitted the request, superuser, or lp.
The following example shows the contents of the /var/spool/lp/tmp/starbug directory:
$ ls /var/spool/lp/tmp/starbug 5 5-0 # cat 5-0 C 1 D print1 F /etc/profile P 20 T /etc/profile t simple U root s 0000 v 2 |
These files remain in their directories only as long as the print request is in the queue. Once the print request is finished, the information in the files is combined and appended to the /var/lp/logs/requests file. This file is described in the next section.
Use the information in the /var/spool/lp/logs directory if you need to track the status of a print request that is currently in the queue.
The LP print service records a history of printing services in two log files, lpsched and requests. These log files are located in the /var/lp/logs directory. You can use the information in these log files to diagnose and troubleshoot printing problems. An example of the contents of the /var/lp/logs directory is as follows:
# cd /var/lp/logs # ls lpsched.1 requests requests.2 lpsched lpsched.2 requests.1 # |
The two most important log files for troubleshooting are the following:
The lpsched log file — Contains information about local printing requests.
The requests log file — Contains information about print requests that are completed and no longer in the print queue.
The requests log file has a simple structure so that you can extract data using common UNIX shell commands. Requests are listed in the order they are printed. They are also separated by lines showing their request IDs. Each line below the separator line, the line that starts with =, is marked with a single letter that identifies the kind of information contained in that line. Each letter is separated from the data by a single space.
The following example shows the contents of a requests log file:
# pwd /var/lp/logs # tail requests.2 = print1-3, uid 0, gid 1, size 206662, Wed Mar 14 08:56:30 MST 2003 z print1 C 1 D print1 F /usr/dict/words P 20 T /usr/dict/words t simple U root s 0x0014 v 2 # |
The following table shows the letter codes and the content of their corresponding lines in the requests log file.
Table 12–9 Codes in the requests Log File
The following table shows the outcome codes in the LP requests log file and their descriptions.
Table 12–10 Outcome Codes in the requests Log File
Outcome Code |
Description |
---|---|
0x0001 |
The request was held pending resume. |
0x0002 |
Slow filtering is running. |
0x0004 |
Slow filtering finished successfully. |
0x0008 |
The request is on the printer. |
0x0010 |
Printing finished successfully. |
0x0020 |
The request was held pending user change. |
0x0040 |
The request was canceled. |
0x0080 |
The request will print next. |
0x0100 |
The request failed filtering or printing. |
0x0200 |
The request is in transit to a remote printer (obsolete). |
0x0400 |
The user will be notified. |
0x0800 |
A notification is running. |
0x1000 |
A remote system has accepted the request (obsolete). |
0x2000 |
The administrator placed a hold on the request. |
0x4000 |
The printer had to change filters. |
0x8000 |
The request is temporarily stopped. |
Files queued for printing are stored in the /var/spool/lp directory until they are printed, which might be only seconds. The following table shows the contents of the /var/spool/lp directory.
Table 12–11 Contents of the /var/spool/lp Directory
File |
Type |
Description |
---|---|---|
SCHEDLOCK |
File |
Lock file for the scheduler. Check for this file if the scheduler terminates and will not restart. |
admins |
Directory |
Link to /etc/lp. |
bin |
Directory |
Link to /usr/lib/lp/bin. |
logs |
Link |
Link to ../lp/logs where completed print requests are logged. |
model |
Link |
Link to /usr/lib/lp/model. |
requests |
Directory |
Directory that contains subdirectories for each configured printer where print requests are logged until printed. Users cannot access this log. |
system |
Directory |
A print status file for the system. |
temp |
Link |
Link to /var/spool/lp/tmp/hostname, which contains the spooled requests. |
tmp |
Directory |
Directory for each configured printer where print requests are logged until printed. Changes to existing print requests are also recorded in this directory. |
Print filters are programs on the print server that convert the content of a queued file from one format to another format.
A print filter can be as simple or as complex as needed. The Oracle Solaris OS provides print filters in the /usr/lib/lp/postscript directory that cover most situations where the destination printer requires the data to be in PostScript format. If you need filters for nonPostScript printers, you have to create the filters and add them to the systems that need filters.
A set of print filter descriptor files are provided in the /etc/lp/fd directory. These descriptor files describe the characteristics of the filter (for example, fast or slow filter). These description files point to the filter program (for example, to /usr/lib/lp/postscript/postdaisy).
The LP print service interacts with other parts of the Oracle Solaris OS. The print service uses a standard printer interface program to do the following:
Initialize the printer port, if necessary. The standard printer interface program uses the stty command to initialize the printer port.
Initialize the printer. The standard printer interface program uses the terminfo database and the TERM shell variable to find the appropriate control sequences.
Print a banner page, if necessary.
Print the correct number of copies specified by the print request.
The LP print service uses the standard interface program, found in the /usr/lib/lp/model directory, unless you specify a different program. You can create custom interface programs. However, you must make sure that the custom program does not terminate the connection to the printer or interfere with proper printer initialization.