[ Team LiB ] Previous Section Next Section

Understanding the Structure of the LP Print Service

The following sections explain the structure and directory hierarchy for the LP print service. The many files of the LP print service are distributed among several directories, as shown in Table 88.

Table 88. Directories for the LP Print Service

Directory

Description

/usr/bin

The lp, lpstat, enable, and disable commands.

/etc/lp

A hierarchy of LP configuration files.

/usr/share/lib

The terminfo database directory.

/usr/sbin

The accept, reject, lpadmin, lpfilter, lpforms, lpmove, lpshut, lpsystems, and lpusers LP commands.

/usr/lib/lp

The LP daemons, directories for binary files and PostScript filters, and the model directory (which contains the standard printer interface program).

/var/lp/logs

The logs for LP activities.

lpsched.n

Messages from lpsched.

/var/spool/lp

The spooling directory in which files are queued for printing.

requests.n[*]

Information about completed print requests.

[*] Moved from /var/lplogs starting with the Solaris 2.6 release. Note that the lpNet log was removed completely from the /var/lp/logs directory because the lpNet daemon is replaced by inetd, starting with the Solaris 2.6 release.

User Commands

The /usr/bin directory contains the lp and lpstat commands, with which users submit and monitor print requests. The directory also contains the enable and disable commands used to enable and disable printers.

Users can customize their print requests by using options for the lp command, specifying forms, character sets, filters, titles, banners, and so forth. Table 89 summarizes the frequently used options for the lp command. These options can be used individually or combined in any order on the command line. When combining options, use a space between options and repeat the dash (-). For example, the following command specifies a destination printer, requests e-mail notification, and prints six copies of a file.


% lp -d printer-name -m -n6 filename
%

Table 89. Summary of Frequently Used lp Options

Option

Name

Description

-d

Destination

Specify a destination printer by name.

-m

Mail

Send e-mail to the user who submitted the print request when the file has been printed successfully.

-n

Number

Specify the number of copies to be printed.

-t

Title

Specify a title for a print request (printed only on the banner page).

-o nobanner

Option

Suppress printing of the banner page for an individual request.

-h

Header

Put a header on each page of the print request.

-c

Copy

Copy the file before printing.

-w

Write

Write a message to root's terminal when the file has printed successfully.

See the lp(1) manual page for a complete list of options.

LP Configuration Files

The scheduler stores configuration information in LP configuration files located in the /etc/lp directory. You can check the contents of these files, but you should not edit them directly. The LP administrative commands provide input for the configuration files in the /etc/lp directory. The lpsched daemon administers and updates the configuration files. You should use the administrative commands any time you need to update any configuration file. Table 90 describes the contents of the /etc/lp directory.

Table 90. Contents of the /etc/lp Directory

Name

Type

Description

alerts

Directory

Contains form, jobdone, printer, and sendMsg scripts for sending print system alerts to users.

classes

Directory

Contains files that identify classes provided by the lpadmin -c command.

fd

Directory

Contains descriptions of existing filters.

forms

Directory

Is the location in which to put files for each form. Initially, this directory is empty.

interfaces

Directory

Contains printer interface program files.

logs

Link to /var/lp/logs

Contains log files of printing activities.

model

Link to /usr/lib/lp/model

Contains the standard printer interface program.

printers

Directory

Contains directories for each (remote or local) printer setup. Each directory contains configuration information and alert files for an individual printer.

pwheels

Directory

Contains print wheel or cartridge files.

The printers directory has a subdirectory for each printer (local or remote) known to the system. The following example shows the subdirectories for the printers pinecone and sparc1.


% ls -l /etc/lp/printers
drwxrwxr-x 2 lp lp 512 Jan 23 23:53 pinecone
drwxrwxr-x 2 lp lp 512 Jan 11 17:50 sparc1
%

Within each of the printer-specific directories, the following files can describe the printer.

  • alert.sh— Shell to execute in response to alerts.

  • alert.vars— Alert variables.

  • configuration— Configuration file.

  • users.deny— List of users who are denied printer access.

  • comment— Printer description.

The following example shows a typical configuration file for the printer pinecone, /etc/lp/printers/pinecone/configuration.


Banner: on: Always
Content types: PS
Device: /dev/term/b
Interface: /usr/lib/lp/model/standard
Printer type: PS
Modules: default



Printer Definitions

The LP print service uses the terminfo database to initialize a local printer; to establish a selected page size, character pitch, line pitch, and character set; and to communicate the sequence of codes to a printer. The terminfo database directory is located in /usr/share/lib.

Each printer is identified in the terminfo database with a short name. If necessary, you can add entries to the terminfo database, but it is a tedious and time-consuming process. Describing how to add entries to the terminfo database is beyond the scope of this book.

Daemons and LP Internal Files

The /usr/lib/lp directory contains daemons and files used by the LP print service, as described in Table 91.

Table 91. Contents of the /usr/lib/lp Directory

Name

Type

Description

bin

Directory

Contains files for generating printing alerts, slow filters, and queue management programs.

local

Directory

Contains LP executables for the local system.

locale

Directory

Contains locale information.

lpsched

Daemon

Manage scheduling of LP print requests.

model

Directory

Contains the standard printer interface program.

postscript

Directory

Contains all PostScript filter programs provided by the Solaris LP print service. These filters come with descriptor files in the /etc/lp/fd directory that tell the LP print service the characteristics of the filters and where to locate them.

LP Administrative Commands

The commands used to set up and administer the LP print service are in the /usr/sbin directory; they are listed in Table 92.

Table 92. The LP Commands in the /usr/sbin Directory

Command

Purpose

accept reject

Accept print requests into the printer's queue or reject print requests.

lpadmin

Define printer names, printer types, file content types, print classes, printer devices, and printer comments; remove printers or print classes; specify fault recovery, interface programs (either custom or standard), printing options, banner/no banner; mount forms; mount print wheels or cartridges; define allow and deny user lists.

lpfilter

Add, change, delete, and list filters.

lpforms

Add, change, delete, and list forms.

lpmove

Move queued print requests from one printer to another.

lpshut

Halt the LP print service (the lpsched command, which starts the LP print service, is in the /usr/lib/lp directory).

lpsystem

Register print servers and print clients with the LP print service.

lpusers

Set queue priorities for users.

Log Files

The LP print service maintains two sets of log files: a list of current requests that are in the print queue (/var/spool/lp) and an ongoing history of print requests (/var/lp/logs/requests).

Print Queue Logs

The scheduler for each system keeps a log of print requests in the directories /var/spool/lp/requests/system and /var/spool/lp/tmp/system. Each print request has two files (one in each directory) that contain information about the request. The information in the /var/spool/lp/requests/system directory can be accessed only by root or lp. The information in the /var/spool/lp/tmp/system directory can be accessed only by root, lp, or the user who submitted the request.

The following example shows the contents of the /var/spool/lp/tmp/pine directory. See Table 93 on page 406 for an explanation of the LP requests log codes.


pine% ls /var/spool/lp/tmp/pine
20-0 21-0
pine% cat 21-0
C 1
D slw2
F /etc/default/login
P 20
t simple
U winsor
s 0x1000

These files remain in their directories only as long as the print request is in the queue. Once the request is finished, the information in the files is combined and appended to the /var/lp/logs/requests file, which is described in the next section.

Use the information in the /var/spool/lp logs if you need to track the status of a print request that is currently in the queue.

History Logs

The LP print service records a history of printing services in the lpsched and requests log files. These log files are located in the /var/lp/logs directory. You can use the information in these logs to diagnose and troubleshoot printing problems. The following example shows the contents of the /var/lp/logs directory.


# cd /var/lp/logs
# ls
lpsched.1     requests     requests.2
lpsched      lpsched.2     requests.1
#

The files with the .1 and .2 suffixes are copies of logs for previous days. Each day, the lp cron job cleans out the lpsched and requests log files; it keeps copies for two days.

The most important log file for troubleshooting is the lpsched log, which contains information about local printing requests.

The requests log contains information about print requests that have completed and are no longer in the print queue. Once a request is finished printing, the information in the /var/spool/lp log files is combined and appended to the /var/lp/logs/requests file.

The requests log has a simple structure, and you can extract data by using common UNIX shell commands. Requests are listed in the order in which they are printed and are separated by lines showing their request IDs. Each line below the separator line 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.


# pwd
/var/lp/logs
# tail requests.2
= slw2-20, uid 200, gid 200, size 5123, Thu Nov 18 01:24:01 EST 2000
z slw2
C 1
D slw2
F /etc/motd
P 20
t simple
U irving
s 0x0100
#

Table 93 shows the codes in the LP requests log.

Table 93. Codes in the LP requests Log

Character

Content of Line

=

The separator line. It contains the following items, separated by commas: the request ID, the user ID and group IDs of the user, the total number of bytes in the original (unfiltered) files, and the time the request was queued. The user ID, group IDs, and file size are preceded by the words uid, gid, and size.

C

The number of copies printed.

D

The printer or class destination or the word any.

F

The name of the file printed. The line is repeated for each file printed; files were printed in the order shown.

f

The name of the form used.

H

One of three types of special handling: resume, hold, and immediate. The only useful value found in this line is immediate.

N

The type of alert used when the print request was successfully completed. The type is the letter M if the user was notified by e-mail or W if the user was notified by a message to the terminal.

O

The -o options.

P

The priority of the print request.

p

The list of pages printed.

r

This single-letter line is included if the user asks for raw processing of the files (the -r option of the lp command).

S

The character set or print wheel (or cartridge) used.

s

The outcome of the request, shown as a combination of individual bits expressed in hexadecimal form. Although several bits are used internally by the print service, the most important bits are listed below.

0x0004 Slow filtering finished successfully.

0x0010 Printing finished successfully.

0x0040 The request was cancelled.

0x0100 The request failed filtering or printing.

T

The title placed on the banner page.

t

The type of content found in the file(s).

U

The name of the user who submitted the print request.

x

The slow filter used for the print request.

Y

The list of special modes to give to the print filters used to print the request.

z

The printer used for the request. This printer differs from the destination (the D line) if the request was queued for any printer or a class of printers or if the request was moved to another destination.

Spooling Directories

Files queued for printing are stored in the /var/spool/lp directory until they are printed. Table 94 shows the contents of the /var/spool/lp directory.

Table 94. Contents of the /var/spool/lp Directory

File

Type

Description

SCHEDLOCK

File

Lock file for the scheduler. Check for this file if the scheduler dies and won't restart.

admins

Directory

Linked to /etc/lp.

bin

Directory

Linked to /usr/lib/lp/bin.

fifos

Directory

Contains pipes that convey networked print requests to and from the inet daemon.

logs

Link

Linked to ../lp/logs where completed print requests are logged.

model

Link

Linked to /usr/lib/lp/model.

requests

Directory

Contains a directory for each configured printer where print requests are logged until printed. Users cannot access this log.

system

Directory

Contains a print status file for the system.

temp

Link

Linked to /var/spool/lp/tmp/printer-name, which contains the spooled requests.

tmp

Directory

Contains a directory for each configured printer where print requests are logged until printed. Changes to existing print requests are also recorded in this log.

    [ Team LiB ] Previous Section Next Section