System Administration Guide, Volume II
  Искать только в названиях книг
Загрузить это руководство в формате PDF

Overview of Print Management

47

This chapter provides fundamental information about managing printers, print clients, and the LP print service. This is a list of the overview information in this chapter.
Planning Printers on Your Networkpage 866
Allocating System Resources for a Print Serverpage 868
Choosing a Method to Install Printerspage 869
Setting Definitions for Printerspage 870
Administering Printerspage 882
Managing Print Requestspage 884
Administering Character Sets, Filters, Forms, and Fontspage 888
The LP Print Servicepage 888
For step-by-step instructions on print management tasks, see:

Planning Printers on Your Network

The goal for setting up printers on a network is to give users access to one or more printers that are used by other systems. This section provides information about distributing printers across your network to gain the best efficiency and about assigning systems as print servers and print clients.
The SunSoft print client software offers a better solution than the LP print software in the Solaris environment for setting up and managing printers on a network. The SunSoft software supports a name service, which enables you to centralize print administration for a network.

Distributing Printers on the Network

As an administrator, you must decide how to allocate printers and determine whether each printer would be best used if it is dedicated to one system or available to many systems and users. In a network environment, it usually works best to distribute your printers on several print servers. The advantage of setting up several print servers is that when one print server has a problem, you can route print requests to other print servers.
If you use a centralized print configuration, you can still connect printers to users' systems for convenience or for improved response. A printer that is connected to a user's system is still available to other systems on the network.
Figure 47-1 shows an example of how you can have a centralized print configuration and still connect printers to users' systems.

Графика

Figure 47-1

Assigning Print Servers and Print Clients

You need to decide which systems will have local printers physically attached to them, and which systems will use printers on other systems. A system that has a local printer attached to it and makes the printer available to other systems on the network is called a print server. A system that sends its print requests to a print server is called a print client.
The LP print service is the software that manages printing services in the Solaris environment. Besides physically connecting a printer to a system, you must define the printer characteristics to the LP print service and make the system a print server. Once you have print servers set up, you can set up other systems as print clients.
Print servers and print clients can run different versions of the SunOS operating system. Systems running the SunOS 5.x operating system can print to existing print servers running the SunOS 4.x operating system, and systems running the SunOS 4.x operating system can print to print servers running the SunOS 5.x operating system.

Note - SunOS 5.x is part of the Solaris 2.x operating environment.

Figure 47-2 shows example print configurations on a network with systems running the SunOS 5.x and 4.x operating systems.

Графика

Figure 47-2

Allocating System Resources for a Print Server

You can attach a printer to a standalone system or to any system on the network. Any networked system with a printer can be a print server, as long as the system has adequate resources to manage the printing load.

Spooling Space

Spooling space is the amount of disk space that is used to store and process requests in the print queue. Spooling space is the single most important factor to consider when deciding which systems to designate as print servers. When users submit files for printing, the files are stored in the /var/spool/lp directory until they have been printed. The size of the /var directory depends on the size of the disk and how the disk is divided into slices. Spooling space may be allocated in the /var directory on the print server hard disk, or mounted from a file server and accessed over the network.

Note - If /var is not created as a separate slice, the /var directory uses space in the root slice, which is likely to be insufficient.

When evaluating systems as possible print servers, consider their available disk space. A large spool directory could consume 600 Mbytes of disk space. Look at the size and division of disk space on systems that could be designated as print servers.
Also carefully evaluate the printing needs and usage patterns of print client systems. If users in a small group typically print only short email messages-- simple ASCII files without sophisticated formatting requirements--a print server with 20 to 25 Mbytes of disk space allocated to /var is probably sufficient. If, however, many print client users are printing large documents or bit-mapped or raster images, they will likely fill up the spooling space quite frequently. When users cannot queue their jobs for printing, work flow is interrupted. Requests for more spooling space may force you to either add disk space for spooling or designate a different system as the print server.
If the print server has a /var directory that resides in a small slice, and if a large amount of disk space is available elsewhere, you can use that space as spooling space by mounting it on the /var directory on the print server. See "Managing File Systems" in the System Administration Guide, Volume I, for information about mounting file systems and editing the vfstab file.

Memory

The Solaris environment requires a minimum of 16 Mbytes of memory to run. A print server does not require additional memory. However, you may find that more memory improves performance in filtering print requests.

Swap Space

The swap space allocation on the print server should be sufficient to handle LP print service requirements. See "Managing File Systems" in the System Administration Guide, Volume I, for information about how to increase swap space.

Hard Disk

For optimal performance, the print server should have a hard disk and a local /var directory. You should mount spooling space for a print server on a local hard disk. If a print server has its own hard disk and a local /var directory, printing is much faster, and you can more accurately predict the time needed to process print requests.

Choosing a Method to Install Printers

The SunSoft print client software and the Printer Manager application in Solstice AdminSuite(TM) offer the best solution for setting up and managing printers on a network. The advantage of the SunSoft print client software is that it supports a name service (NIS or NIS+), which enables you to centralize print administration for a network.
Admintool(TM) provides an alternative method to install printers in the Solaris environment. Admintool is a graphical user interface that simplifies tasks for setting up and managing printers. See Chapter 48, "Setting Up Printers," for step-by-step instructions on using Admintool.
You must run Admintool on the system to which you have attached the printer, because Admintool does not enable you to make changes to a remote system. When setting up a printer, Admintool makes the appropriate changes in the system's /etc/lp directory. You can use Admintool to set up a system
as a print server or print client only if it is running the SunOS 5.x operating system. Setting up SunOS 4.x print servers and clients is fully described in the SunOS 4.x documentation.
Most of your needs for setting up printing services should be met by Admintool. However, if you have special needs, such as writing scripts, you may want to use the LP print service commands (which underlie Admintool) directly. The setup process with commands is described in "Setting Up a Printer With the LP Print Service Commands" on page 923.

Setting Definitions for Printers

Establishing definitions for the printers on your network is an ongoing task that enables you to provide a more effective print environment for users. For example, you can assign printer descriptions for all your site's printers to help users find where a printer is located, or you can define a class of printers to provide the fastest turnaround for print requests.
The lpadmin command enables you to set all of the print definitions, while Admintool enables you to set only some of them when you install or modify a printer. Table 47-1 lists the print definitions and shows whether you can assign the definition with Admintool.
Table 47-1
Print DefinitionCan You Set It With Admintool?
Printer nameYes
Printer descriptionYes
Printer portYes
Printer typeYes
File contentsYes, but with less functionality than the lpadmin command
Fault notificationYes, but with less functionality than the lpadmin command
Default printer destinationYes
Printing banner pagesYes, but with less functionality than the lpadmin command
Table 47-1 (Continued)
Print DefinitionCan You Set It With Admintool?
Limiting user access to a printerYes, but with less functionality than the lpadmin command
Printer classNo
Fault recoveryNo

Printer Name

When adding a printer to a system, you specify a printer name for the printer. A printer name must be unique among all printers known to the system. The name can contain a maximum of 14 alphanumeric characters, which may include dashes and underscores. When administering printers in a complex network, keep printer names unique within the bounds of the administrative domain.
You should also establish conventions when naming printers. Choose printer names that are meaningful and easy to remember. A printer name can identify the type of printer, its location, or the print server name.
Establish a naming convention that works for your site. For example, if you have different types of printers on the network, including the printer type as part of the printer name can help users choose an appropriate printer. For instance, you could identify PostScript(TM) printers with the letters PS. If, however, all of the printers at your site are PostScript printers, you would not need to include the initials PS as part of the printer name.

Printer Description

You can assign a description to a printer by using the lpadmin -D command or Admintool. The printer's description should contain information to help users identify the printer. You might include the room number where the printer is located, the type of printer, the manufacturer, or the name of the person to call if there are printing problems.
Users can look at a printer description by using the following command:

  $ lpstat -D -p printer-name  

Printer Port

When you install a printer or later change its setup, you can specify the device, or the printer port, to which the printer is connected, by using Admintool or the lpadmin -p printer-name -v device-name command.
Most systems have two serial ports and a parallel port. Unless you add ports, you cannot connect more than two serial printers and a parallel printer to one system.
With Admintool, you can select either /dev/term/a or /dev/term/b, or choose Other and specify any port name that the print server recognizes. These options give you as much flexibility as the lpadmin command.
The LP print service initializes the printer port using the settings from the standard printer interface program. See "Managing Print Filters" on page 973 for more information about printer interface programs. If you have a parallel printer or a serial printer for which the default settings do not work, see "Adjusting Printer Port Characteristics" on page 1000 for information about customizing the port settings.

Note - If you are using multiple ports on an x86 system or a PowerPC(TM) microprocessor-based system, keep in mind that the first port is the only port that is enabled by default. The second and any subsequent ports are disabled by default. To use more than one port, you must manually edit the port configuration file for each additional asy (serial) port or lp (parallel) port.
For the x86 platform, the pathnames for the port configuration files are:
/platform/i86pc/kernel/drv/asy.conf
/platform/i86pc/kernel/drv/lp.conf

For the PowerPC platform, the pathnames for the port configuration files are:
/platform/prep/kernel/drv/asy.conf
/platform/prep/kernel/drv/lp.conf

See the x86 Device Configuration Guide (available in hardcopy only) for information about configuring serial and parallel ports on x86 systems.
See the Solaris 2.5 PowerPC Edition release notes, installation notes, or device configuration document for information about configuring serial and parallel ports on PowerPC microprocessor-based systems.

Printer Type

The printer type is a generic name for a type of printer. It identifies the terminfo database entry that contains various control sequences for the printer. By convention, printer type is usually derived from the manufacturer's model name. For example, the printer type name for the DECwriter(TM) printer is decwriter. However, the common printer type PS does not follow this convention. PS is used as the printer type for many models of PostScript printers, such as LaserWriter(R)I and LaserWriterII printers.
You can specify the printer type by using the lpadmin -T command or Admintool. With Admintool, you can specify the printer type only when you are installing a printer. If you want to change the type of an existing printer, you must delete the printer and reinstall it by using Admintool, otherwise change the printer type by using the lpadmin command.
Admintool enables you to select a printer type from a menu or choose Other and specify any printer type in the terminfo database. This provides you as much capability as the lpadmin command.

Entries in the terminfo Database

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   4   7   A   M   a   d   g   j   m   p   s   u   x  
  2   5   8   B   P   b   e   h   k   n   q   t   v   y  
  3   6   9   H   S   c   f   i   l   o   r   ti  w   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(R) printer, look in /usr/share/lib/terminfo/e to find your particular model of Epson printer.

  $ cd /usr/share/lib/terminfo/e  
  $ ls  
  emots           ep2500+high      ep48              ergo4000       exidy2500  
  env230          ep2500+low       epson250          esprit  
  envision230     ep40             epson2500-80      ethernet  
  ep2500+basic    ep4000           epson2500-h       ex3000  
  ep2500+color    ep4080           epson2500-hi8     exidy  
  $  

The entries for Epson printers are included in the preceding example.
If you have a NEC(R) printer, look in the /usr/share/lib/terminfo/n directory for your NEC printer model.

  $ cd /usr/share/lib/terminfo/n  
  $ ls  
  ncr7900        ncr7901        netty-Tabs     newhpkeyboard  
  ncr7900-na     nec                  netty-vi       nuc  
  ncr7900i       net            network        nucterm  
  ncr7900i-na    netronics      netx  
  ncr7900iv      netty          newhp  
  $  

The entry in this directory for NEC is included in the preceding example.

Selecting a Printer Type

For a local PostScript printer, use a printer type of either PostScript (PS) or Reverse PostScript (PSR). If your printer supports PostScript, choose PS or PSR even if the specific printer type is listed in the terminfo database.
If your PostScript printer prints pages face up, documents appear to be printed backwards--the first page is at the bottom of the stack and the last page is on the top. If you specify the printer's type as PSR, the LP print service reverses
the order of the pages before sending them to the printer; the last page is printed first, and the pages are stacked in forward order. However, the LP print service can reliably change the page order only for PostScript files that conform to the Adobe(R) Document Structuring conventions in Appendix C of the PostScript Language Reference Manual (written by Adobe Systems Incorporated, and published by Addison-Wesley, 1990).
If a printer can emulate more than one kind of printer, you can assign it several types by using the lpadmin -T command. If you specify more than one printer type, the LP print service uses the type that is appropriate for each print request.
You may not find the printer type in the appropriate terminfo directory. The type of printer is not necessarily linked to the manufacturer's name on the printer. For example, for any type of PostScript printer, you can use the PS or PSR entry (found in the /usr/share/lib/terminfo/P directory) instead of an entry specific to manufacturer or product names.
If you have an unusual type of printer, you may need to try different entries before you can determine whether a particular terminfo entry works for your model of printer. If possible, find an entry in the terminfo database that works for your printer. It will be much easier than trying to create an entry. If you have to create your own entry, "Adding a terminfo Entry for an Unsupported Printer" on page 1002 contains some useful tips.
See "Frequently Used Printers" on page 876 for information about the printer type and file content type for printers that are most commonly used with SunOS 5.x software.

File Content Type

Print filters convert the content type of a file to a content type that is acceptable to the destination printer. The file content type tells the LP print service the type of file contents that can be printed directly, without filtering. To print without filtering, the necessary fonts must also be available in the printer. (You must set up and use filtering for other types of files.)
You can specify the file content type for a printer by using the lpadmin -I command or Admintool. With Admintool, you can select a file contents type from a menu. Not all available file content types are listed on the menu. You must use the lpadmin command to specify file content types that are not included on the Admintool menu.
Many printers can print two types of files directly:
  • The same type as the printer type (for example, PS for a PostScript printer)
  • The type simple (an ASCII file)
When submitting a file for printing, the user can indicate the content type of the file (lp -T content-type). Otherwise, a file is assumed to be simple (ASCII text). The LP print service uses the file content type to determine which filters to use to convert the file contents into a type the printer can handle.
Admintool provides a list of file content types from which you can choose when installing or modifying a local printer. The choices are translated to the names that the LP print service uses. Table 47-2 describes the file content types you can choose with Admintool.
Table 47-2
File Contents ChoiceLP Print Service NameDescription
PostScriptpostscriptPostScript files are not filtered. ASCII files are filtered.
ASCIIsimplePostScript files are filtered. ASCII files are not filtered.
Both PostScript and ASCIIsimple,postscriptPostScript files and ASCII files are not filtered.
None""All files are filtered, except those matching the printer's type.
AnyanyNo filtering. If the printer cannot handle a file content type directly, the file will not be printed.
Choose the file content type that best matches the printer's capabilities. PostScript (which means filtering is not needed for PostScript files) is the default choice in Admintool and is probably correct most of the time.

Frequently Used Printers

This section provides the printer type and file content type for the printers most commonly used with SunOS 5.x software. Although not shown, many of these printers can also directly print files with simple content type.
If you have a PostScript printer, use a printer type of PS or PSR and a content type of postscript. PSR reverses the pagination and prints the banner page last.
Table 47-3 lists additional non-PostScript printers and shows the printer type to use for configuring each printer. For all these printers, the file content type is simple.

Note - Sun does not supply filtering software for the printers listed in Table 47-3, among others. However, you can use unsupported printers if you supply filtering or if the printer can directly print the file content type. If you have questions about any printer for which Sun does not supply filters, contact the printer manufacturer.

Table 47-3
PrinterPrinter Type
Daisydaisy
Datagraphixdatagraphix
DEC LA100la100
DEC LN03ln03
DECwriterdecwriter
Diablodiablo
diablo-m8
Epson 2500 variationsepson2500
epson2500-80
epson2500-hi
epson2500-hi80
Hewlett-Packard HPCL printerhplaser
IBM Proprinteribmproprinter
If you want to set up a printer that is not in the terminfo database, see "How to Add a terminfo Entry for an Unsupported Printer" on page 1005.

Fault Notification

If you choose, the print service can notify you when it detects a printer fault. You can select any of the following methods to receive printer fault notification with the lpadmin -A command or with Admintool:
  • Write a message to the terminal on which root is logged in
  • Electronic mail to root
  • No notification
However, the lpadmin -A command offers you an additional option of receiving a message specified by the program of your choice. It also enables you to selectively turn off notification for an error that you already know about.
Unless you specify a program to deliver fault notification, the content of the fault alert is a predefined message that says the printer has stopped printing and needs to be fixed.
Also, if you choose not to send any fault notification, you need a way to find out about printing faults so you can correct the problem. The LP print service will not continue to use a printer that has a fault. In addition to alerts for printer faults, you can also provide alerts that tell the system administrator to mount print wheels, font cartridges, and forms when print requests require them.

Default Printer Destination

You can specify a default printer destination for a system so you don't need to type the printer name when using the print commands. Before you can designate a printer as the default, the printer must be known to the print service on the system. You can set a system's default printer destination by setting any of the following:
  • LPDEST environment variable
  • PRINTER environment variable
  • System's default printer (by using the lpadmin -d command or Admintool)
When an application provides a printer destination, that destination is used by the print service, regardless of whether you have set a system's default printer destination. If an application doesn't provide a printer destination or if you
don't provide a printer name when using a print command, the print command searches for the default printer in a specific order. Table 47-4 shows the search order for a system's default printer destination.
Table 47-4
Search OrderUsing /usr/bin/lp CommandUsing lpr, lpq, and lprm Commands
FirstLPDEST variablePRINTER variable
SecondPRINTER variableLPDEST variable
ThirdSystem's default printerSystem's default printer

Printing Banner Pages

A banner page identifies who submitted the print request, the print request ID, and when the request was printed. A banner page can also have an optional title that helps users identify their printouts.
Banner pages make identifying the owner of a print job easy, which is especially helpful when many users submit jobs to the same printer. Printing banner pages uses more paper, however, and may not be necessary if a printer has only a few users. In some cases, printing banner pages is undesirable. For example, if a printer has special paper or forms mounted, like paycheck forms, printing banner pages may cause problems.
By default, the print service forces banner pages to be printed. However, you can give users a choice to turn off printing of a banner page when they submit a print request. You can set this choice through the lpadmin command or through Admintool. If you give the users a choice, they have to use the -o nobanner option to turn off printing of a banner page.
Also, you can turn off banner pages for a printer so they are never printed. This is important if you have a situation where you don't need or want banner pages. You can turn off banner page printing through the command line interface only. For step-by-step command-line instructions, see "How to Turn Off Banner Pages" on page 942.

Limiting User Access to a Printer

You may want to control which users can access some or all of the available printers. For example, you may want to prevent some users from printing on a high-quality printer to minimize expense. To restrict user access to printers, you can create allow and deny lists using the lpadmin -u command. (Admintool enables you to create only allow lists.) If you create neither, a printer is available to all users who can access the printer.
An allow list contains the names of users allowed access to the specified printer; a deny list contains the names of users denied access to the specified printer.
The rules for allow and deny lists are:
When You ...Then ...
Do not create allow and deny lists,
or if you leave both lists empty
All users may access the printer.
Specify all in the allow listAll users may access the printer.
Specify all in the deny listAll users, except root and lp, are denied access to the printer.
Make any entry in the allow listThe deny list is ignored. Only those users who are listed can access the printer.
Create a deny list, but you do not create an allow list or you leave the allow list emptyUsers who are listed in the deny list are denied access to the printer.
It is best to create allow and deny lists on the print server only and not set up allow and deny lists on print clients. If you create allow and deny lists on the print server only, the print server exclusively controls user access to printers. The benefit of using this strategy is that you do not have to coordinate changes to the print server's allow and deny lists with print clients.

Printer Class

The print service enables you to group several local printers into one class. You can perform this task only by using the lpadmin -c command.
When you have set up a printer class, users can then specify the class (rather than individual printers) as the destination for a print request. The first printer in the class that is free to print is used. The result is faster turnaround because printers are kept as busy as possible.
There are no default printer classes known to the print service; printer classes exist only if you define them. Here are some ways you could define printer classes:
  • By printer type (for example, PostScript)
  • By location (for example, 5th floor)
  • By work group or department (for example, Accounting)
Alternatively, a class might contain several printers that are used in a particular order. The LP print service always checks for an available printer in the order in which printers were added to a class. Therefore, if you want a high-speed printer to be accessed first, you would add it to the class before you add a low-speed printer. As a result, the high-speed printer would handle as many print requests as possible. The low-speed printer would be reserved as a backup printer when the high-speed printer is in use.

Note - Print requests are balanced between printers in a class only for local printers. When a print client attempts to print to a class of printers on a print server, only the first printer defined in the class is used.

Class names, like printer names, must be unique and may contain a maximum of 14 alphanumeric characters and underscores.
You are not obligated to define printer classes. You should add them only if you determine that using printer classes would benefit users on the network.

Fault Recovery

You can define the fault recovery options for a printer only by using the lpadmin -F command. This task is not available in Admintool.
Printer faults can be as simple as running out of paper or needing to replace a toner cartridge. Other more serious problems may include complete printer failure or power failure. After you fix a printer fault, the print request that was active when the fault occurred begins printing in one of three ways:
  • Starts printing from the beginning
  • Continues printing from the top of the page where printing stopped
  • After you enable the printer, continues printing from the top of the page where the printing stopped
A print filter is required to continue printing from the top of a page where the printing stopped. A print filter records the control sequences used by the printer to track page boundaries, which the default filters used by the print service cannot do. You will be notified by the print service if recovery cannot proceed with the specified print filter. For information about writing filters, see "How to Create a New Print Filter" on page 1022.
If you want printing to resume immediately after a printer fault is fixed, enable the printer by using the enable command.

Administering Printers

After you set up print servers and print clients, there are a number of administration tasks you may need to perform frequently:
  • Deleting a printer and remote printer access
  • Checking the status of printers
  • Restarting the print scheduler
See Chapter 49, "Administering Printers," for step-by-step instructions on how to perform the printer administration tasks.

Deleting Printers and Printer Access

If a printer needs to be replaced or you want to move the printer to a different location, you must delete the printer information from the LP print service before you physically remove it from the print server. You should also make sure that all the current print requests on the printer are printed or moved to another printer to be printed.
Not only does the printer information need to be deleted from the print server, but it also needs to be deleted from the print clients. If you delete a local printer from a print server, you should delete the remote printer entry from the print clients. If you move a printer to another print server, you need to delete the old remote print entry from the print clients and add access to the remote printer in its new location.
See "How to Delete a Printer and Remote Printer Access" on page 930 for detailed information on how to delete a local and remote printer. You can use Admintool to delete a local or remote printer; however, Admintool does not enable you to move queued print request to another printer.

Checking Printer Status

Many routine printer administration tasks require information about the status of the LP print service or a specific printer. For example, you may need to determine which printers are available for use and examine the characteristics of those printers. You can use the lpstat command to find out status information about the LP print service or a specific printer.

Restarting the Print Scheduler

The print scheduler, lpsched, handles print requests on both a print client and print server. However, there may be times when the print scheduler stops running on a system, so print requests stop being accepted or printed.
To restart the print scheduler, you can use the /usr/lib/lp/lpsched command. If a print request was printing when the print scheduler stopped running, the print request will be printed in its entirety when you restart the print scheduler.

Managing Print Requests

When a user submits a print request from a print client, the print request is added to a queue on the print server before it is sent to the printer. While a print request is in the queue, you can cancel, move, hold, resume, or change the priorities of print requests. These actions can help you keep printing services operating smoothly.
The print commands enable you to perform all print request management tasks. Admintool enables you to perform some print request management tasks when you modify a print server. Table 47-5 lists the print request management tasks you can perform with Admintool.
Table 47-5
TaskCan You Do With Admintool?
Canceling a print requestNo
Moving a print requestNo
Changing priority of print requestsNo
Accepting or rejecting print requestsYes
Processing or stopping printingYes

Canceling a Print Request

You can use the cancel command to cancel print requests from printer queues or to cancel jobs that are printing. There are three ways to use the cancel command:
  • To cancel requests by request identification number (request ID)
  • To cancel requests from a specific user on all, or specified, printers
  • To cancel the job currently printing
When you use cancel, a message tells you the request(s) are canceled, and the next request in queue is printed. You can cancel a print request only if you are:
  • The user who submitted the request and you are logged in on the system from which you submitted the request
  • Logged in as root or lp on the print server
To cancel a specific request, you need to know its request ID. The request ID is comprised of the name of the printer, a dash, and the number of the print request--for example, luna-185. When you submit the print request, the request ID is displayed. If you do not remember the print request ID, you can find it by using the lpadmin command without any options.

Moving a Print Request

If you plan to change the way a printer is used or decide to take a printer out of service, you should set up the LP print service to reject additional print requests, and then move or cancel any requests that are currently queued to the printer. You can use the lpmove command to move individual or all print requests to another local printer.
Request IDs are not changed when you move print requests, so users can still find their requests. Print requests that have requirements (such as file content type or forms) that cannot be met by the newly specified printer cannot be moved; they must be canceled.

Changing the Priority of Print Requests

After a user has submitted a print request, you can change its priority in the print server's queue in the following ways:
  • You can put any print request on hold if it has not finished printing. Putting a request on hold stops it, if it is currently printing, and keeps it from printing until you resume printing it. Other print requests go ahead of the on-hold request.
  • You can move any print request to the head of the queue, where it will be the next job eligible for printing. If you want a job to start printing immediately, you can interrupt the job that is currently printing by putting it on hold.
  • You can change the priority of a job still waiting to be printed, moving it in the queue so it is ahead of lower priority requests and behind requests at the same level or at a higher priority.

Accepting or Rejecting Print Requests

The accept and reject commands--or the Accept Print Requests field in Admintool's Modify Printer window--enable you to turn on or turn off a print queue that stores requests to be printed.
When you use the reject command, the print queue for a specified printer is turned off--no new print requests can enter the queue. All print requests that are in the queue are still printed. You must disable the printer if you want it to stop printing requests that are already in the queue. Table 47-6 compares the functions of the accept/reject and enable/disable commands.
Table 47-6 accept/rejectenable/disable
CommandFunction
acceptAccept print requests that are sent to the print queue.
enablePrint the requests that are in the print queue.
rejectReject print requests that are sent to the print queue.
disableStop printing requests that are currently in the print queue.
See "Processing or Stopping Printing" on page 887, for information about disabling a printer.
If a print request is rejected, the print service writes a message to the user who submitted the request, saying that print requests are not being accepted for the specified printer.
You can also specify a reason for not accepting requests through the command line. The reason will be displayed on users' systems whenever they try to check the printer's queue.
Figure 47-3 shows the point at which processing of print requests is interrupted when a print queue rejects print requests.

Графика

Figure 47-3

Processing or Stopping Printing

The enable and disable commands--or the Process Print Requests field on Admintool's Modify Printer window--control whether a printer prints or stops printing requests that are in the print queue. When you disable a printer, the printer stops printing requests in queue; however, requests are still added to the queue. (You must set the printer to reject print requests so requests are not added to the queue. See "Accepting or Rejecting Print Requests" on page 886 for information about rejecting print requests.)
You must enable the printer whenever it has been disabled, which may happen when a printer fault occurs. When you enable a printer, it prints requests from the print queue until the queue is empty, even if the print service rejects additional requests for the print queue.
Figure 47-4 shows the point at which processing of print requests is interrupted when a printer is disabled.

Графика

Figure 47-4

Administering Character Sets, Filters, Forms, and Fonts

Depending on your site's requirements and the types of printers you have on the network, you may have to set up and administer printer-specific features of the LP print service. For example, you can assign different print wheels, filters, and forms to different printers. See Chapter 50, "Managing Character Sets, Filters, Forms, and Fonts" for background information and step-by-step instructions on how to set up and administer character sets, print filters, forms, and fonts.

The LP Print Service

The LP print service is a set of software utilities that allows users to print files while they continue to work. Originally, the print service was called the LP spooler. (LP stood for line printer, but its meaning now includes many other types of printers, such as laser printers. Spool is an acronym for system peripheral operation off-line.)
The print service consists of the LP print service software, any print filters you may provide, and the hardware (the printer, system, and network connections).

The Structure of the LP Print Service

This section provides information about the directory structure, files, logs, and commands of the LP print service.

Directories

The many files of the LP print service are distributed among seven directories, as shown in Table 47-7.
Table 47-7
DirectoryContents
/usr/binThe LP print service user commands
/etc/lpA hierarchy of LP configuration files
/usr/share/libThe terminfo database directory
/usr/sbinThe LP print service administrative commands
/usr/lib/lpThe LP daemons; directories for binary files and PostScript filters; and the model directory (which contains the standard printer interface program)
/var/lp/logsThe logs for LP activities

lpNet - Messages from lpNet lpsched.n - Messages from lpsched requests.n - Information about completed print requests

/var/spool/lpThe spooling directory where files are queued for printing

Configuration Files

The scheduler stores configuration information in LP configuration files located in the /etc/lp directory, as described in Table 47-8.

CAUTION Caution - The configuration files listed in Table 47-8 are private interfaces, and 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.

Table 47-8 /etc/lp
FileTypeDescription
SystemsASCII fileNames of systems defined using the lpsystem command. Includes every remote system with which the local system can exchange print requests.
classesDirectoryFiles identifying classes provided by the lpadmin -c command.
defaultASCII fileName of the default destination provided by the lpadmin -d command.
fdDirectoryDescription of existing filters.
filter.tableFilePrint filter lookup table.
formsDirectoryLocation to put files for each form. Initially, this directory is empty.
interfacesDirectoryPrinter interface program files.
logsLink to /var/lp/logsLog files of printing activities.
modelLink to

/usr/lib/lp/model

The standard printer interface program.
printersDirectoryDirectories for each (remote or local) printer. Each directory contains configuration information and alert files for an individual printer.
pwheelsDirectoryPrint wheel or cartridge files.
These configuration files serve the function of the /etc/printcap file in SunOS 4.1.

Note - You can check the contents of the configuration files, but you should not edit them directly. Instead, use the lpadmin(1M)command make configuration changes. Your changes will be 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 printer (local or remote) 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  

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 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 terminfo Database

The /usr/share/lib directory contains the terminfo database directory, which contains definitions for many types of terminals and printers. The LP print service uses information in the terminfo database to initialize a printer, to establish a selected page size, character pitch, line pitch, and character set, as well as to communicate the sequence of codes to a printer.
Each printer is identified in the terminfo database with a short name. See "Printer Type" on page 873 for a description of the structure of the terminfo database. If necessary, you can add entries to the terminfo database, but it is a tedious and time-consuming process. See "Adding a terminfo Entry for an Unsupported Printer" on page 1002.

Daemons and LP Internal Files

The /usr/lib/lp directory contains daemons and files used by the LP print service, as described in Table 47-9.
Table 47-9 /usr/lib/lp
FileTypeDescription
binDirectoryContains files for generating printing alerts, slow filters, and queue management programs.
lpNetDaemonControls LP requests for network printing.
lpdataELF executable fileLists LP print service configuration
information (interactive command).
lpschedDaemonManages scheduling of LP print requests.
modelDirectoryContains the standard printer interface program.
postscriptDirectoryContains all PostScript filter programs provided by the SunOS 5.x 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.

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)
  • 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/tmp/system and /var/spool/lp/requests/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 can be accessed only by the user who submitted the request, root, or lp.
The following example shows the contents of the /var/spool/lp/tmp/terra directory:

  $ ls /var/spool/lp/tmp/terra  
  20-0 21-0  
  terra$ cat 21-0  
  C 1  
  D slw2  
  F /etc/default/login  
  P 20  
  t simple  
  U tamiro  
  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 file /var/lp/logs/requests, 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 three log files: lpNet, lpsched, and requests. 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. This is an example of the contents of the /var/lp/logs directory:

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

The files with the .1 and .2 suffixes are copies of the previous day's logs. Each day, the lp cron job cleans out the lpsched and requests log files and keeps copies for two days. See "Creating and Editing crontab Files" in Chapter 68, "Scheduling System Events," for suggestions on modifying the cron job for cleaning out the requests log.
The two most important log files for troubleshooting are:
  • The lpNet log, which contains information about network printing
  • The lpsched log, which contains information about local printing requests
The requests log contains information about print requests that are completed and 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 log.
The requests log has a simple structure, so that you can extract data using common UNIX shell commands. Requests are listed in the order 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, Mon Jun 20 01:24:01 EST  
  1995  
  z slw2  
  C 1  
  D slw2  
  F /etc/motd  
  P 20  
  t simple  
  U irving  
  s 0x0100  
  #  

Table 47-10 shows the letter codes and the content of their corresponding lines in the LP requests log.
Table 47-10 requests
LetterContent of Line
=The separator line. It contains the following items: request ID, user ID (UID), and group IDs (GIDs) of the user, the total number of bytes in the original (unfiltered) file size, and the time when the request was queued.
CThe number of copies printed.
DThe printer or class destination or the word any.
FThe name of the file printed. The line is repeated for each file printed; files were printed in the order shown.
fThe name of the form used.
HOne of three types of special handling: resume, hold, and immediate.
NThe type of alert used when the print request was successfully completed. The type is the letter M if the user was notified by email or W if the user was notified by a message to the terminal.
OThe printer-dependent -o options (for example, nobanner).
PThe priority of the print request.
Table 47-10 requests(Continued)
LetterContent of Line
pThe list of pages printed.
rA single-letter line that is included if the user asked for "raw" processing of the files (the -r option of the lp command).
SThe character set, print wheel, or cartridge used.
sThe outcome of the request, shown as a combination of individual bits expressed in hexadecimal form. Several bits are used internally by the print service. The bits and what they mean are describe in Table 47-11.
TThe title placed on the banner page.
tThe type of content found in the files.
UThe name of the user who submitted the print request.
xThe slow filter used for the print request.
YThe list of special modes for the print filters used to print the request.
zThe 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.
Table 47-11 shows the outcome codes in the LP requests log and their descriptions.
Table 47-11 requests
Outcome CodeDescription
0x0001The request was held pending resume.
0x0002Slow filtering is running.
0x0004Slow filtering finished successfully.
0x0008The request is on the printer.
0x0010Printing finished successfully.
0x0020The request was held pending user change.
0x0040The request was canceled.
Table 47-11 requests
Outcome CodeDescription
0x0080The request will print next.
0x0100The request failed filtering or printing.
0x0200The request is in transit to a remote printer.
0x0400The user will notified.
0x0800A notification is running.
0x1000A remote system has accepted the request.
0x2000The administrator placed a hold on the request.
0x4000The printer had to change filters.
0x8000The request is temporarily stopped.

Spooling Directories

Files queued for printing are stored in the /var/spool/lp directory until they are printed, which may be only seconds. Table 47-12 shows the contents of the /var/spool/lp directory.
Table 47-12 /var/spool/lp
FileTypeDescription
SCHEDLOCKFileLock file for the scheduler. Check for this file if the scheduler dies and will not restart.
adminsDirectoryLink to /etc/lp.
binDirectoryLink to /usr/lib/lp/bin.
fifosDirectoryPipes that convey networked print requests to and from the lpNet daemon.
logsLinkLink to ../lp/logs where completed print requests are logged.
modelLinkLink to /usr/lib/lp/model.
requestsDirectoryDirectory that contains subdirectories for each configured printer where print requests are logged until printed. Users cannot access this log.
Table 47-12 /var/spool/lp(Continued)
FileTypeDescription
systemDirectoryA print status file for the system.
tempLinkLink to /var/spool/lp/tmp/printer-name, which contains the spooled requests.
tmpDirectoryDirectory for each configured printer where print requests are logged until printed. Changes to existing print requests are also recorded in this log.

LP Print Service Commands

Table 47-13 lists frequently used LP print service commands. You must be root or lp to use the 1M commands.
Table 47-13
CommandTask
enable(1)Activate a printer
cancel(1)Cancel a print request
lp(1)Send one or more file(s) to a printer
lpstat(1)Report the status of the LP print service
disable(1)Deactivate one or more printers
accept(1M)Permit print requests to be queued for a specific destination
reject(1M)Prevent print requests from being queued for a specific destination
lpadmin(1M)Set up or change printer configuration
lpfilter(1M)Set up or change filter definitions
lpforms(1M)Set up or change preprinted forms
lpadmin(1M)Mount a form
lpmove(1M)Move output requests from one destination to another
Table 47-13 (Continued)
CommandTask
lpsched(1M)Start the LP print service scheduler
lpshut(1M)Stop the LP print service scheduler
lpusers(1M)Set or change the default priority and priority limits that can be requested by users of the LP print service

Functions of the LP Print Service

The LP print service performs the following functions:
  • Administers files and schedules local print requests
  • Schedules network requests
  • Filters files (if necessary) so they print properly
  • Starts programs that interface with the printers
  • Tracks the status of jobs
  • Tracks forms mounted on the printer
  • Tracks print wheels currently mounted
  • Delivers alerts to mount new forms or different print wheels
  • Delivers alerts about printing problems
"The Structure of the LP Print Service" on page 889 describes the directory structure and commands.

How LP Administers Files and Schedules Local Print Requests

The LP print service has a scheduler daemon called lpsched. The scheduler daemon updates the LP system files with information about printer setup and configuration.
The lpsched daemon also schedules all local print requests, as shown in Figure 47-5 on page 900, regardless of whether users issue the requests from an application or from the command line. In addition, the scheduler tracks the status of printers and filters. When a printer finishes printing a request, the scheduler schedules the next request, if there is one in the queue.

Графика

Figure 47-5 lpsched

Each print client and print server must have only one LP scheduler running. The scheduler is started when a system is booted (or enters run level 2) by the control script /etc/rc2.d/S80lp. Without rebooting the systems, you can
stop the scheduler with the /usr/lib/lp/lpshut command and restart the scheduler with the lpsched command. The scheduler for each system manages requests issued to the system by the lp commands.

Scheduling Network Print Requests

Each print client and print server must have one or more lpNet daemons. The lpNet daemon schedules network print requests. The lpNet daemon is started when a system is booted. If you stop and restart the scheduler (using the lpshut and lpsched commands), the lpNet daemon is also stopped and restarted.
The lpNet daemon needs a configured port monitor and registered listen services to handle incoming network requests on each print server running SunOS 5.x system software.

Filtering Print Files

Print filters are programs on the print server that convert the content of a queued file from one format to another.
A print filter can be as simple or as complex as needed. SunOS 5.x system software provides print filters in the /usr/lib/lp/postscript directory that cover most PostScript printing situations--where the destination printer requires the data to be in PostScript format. If you need filters for non-PostScript printers, you have to create the filters and add them to the systems that need them.
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), and point to the filter program (for example, /usr/lib/lp/postscript/postdaisy).

What the Printer Interface Program Does

The LP print service interacts with other parts of the operating system. It uses a standard printer interface program to:
  • 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 one. You can create custom interface programs, but you must make sure that the custom program does not terminate the connection to the printer or interfere with proper printer initialization.

How the lpsched Daemon Tracks the Status of Print Requests

The lpsched daemon on both the print server and print client keeps a log of each print request that it processes and notes any errors that occur during the printing process. This log is kept in the /var/lp/logs/lpsched file. Every night, the lp cron job renames /var/lp/logs/lpsched to a new lpsched.n file and starts a new log file. If errors occur or jobs disappear from the print queue, you can use the log files to determine what lpsched has done with a printing job.

Tracking Forms

The LP print service helps you track which forms are mounted on each printer and notifies you when it cannot find a description it needs to print a form. You are responsible for creating form descriptions and mounting and unmounting form paper in each printer, either as part of setting up a printer or in response to alerts from the LP print service.
Users can specify the form on which they want a job to print. As root, you can mount a specific form, then tell the LP print service that the form is available and on which printer it is mounted. Or users can submit print requests specifying a particular form and whether the form is mounted. When the LP print service receives the request, it sends an alert message to root requesting that you mount the form.

Tracking Print Wheels

The procedure for tracking print wheels is similar to the procedure for tracking forms. Some printers (usually letter-quality printers) have removable print heads, such as print wheels or print cartridges, that provide a particular font or character set. A user can request a named character set. If that character set is not available, the LP print service notifies root of the request. The job is stored in the print queue until the print wheel is changed.

Receiving Printing Problem Alerts

The LP print service performs sophisticated error checking. If a printing problem occurs, alerts are sent to the originator of a print request, or to the system administrator, depending on the nature of the problem and what is required to correct it. Users are notified when a print request cannot be completed. If users request it, they are notified by email when a job is successfully completed. The LP print service alerts administrators of problems with printers, and of requests for filters, forms, or character sets.
For problems that require an administrator's attention, the LP print service default is to write an alert message to the console window of the system on which root is logged in.
As the system administrator, you can change the alert policy to receive alert messages via:
  • Electronic mail
  • A program of your choice

Cleaning Out Log Files

The lpsched, lpNet, and requests log files in the /var/lp/logs directory grow as information is appended. The LP print service uses a default cron job to clean out the log files. The lp cron job is located in the /var/spool/cron/crontabs/lp file. It periodically moves the contents of
the log files. The contents of log are moved to log.1, and the contents of log.1 are moved to log.2. The contents of log.2 are lost (that is, replaced by the former contents of log.1) when log.2 gets overwritten.

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

How Local Printing Works

Figure 47-6 on page 905 shows what happens when a user submits a request to print a PostScript file on a local printer, which is a printer connected to the user's system. The local system does all processing; no network printing software is used.

Графика

Figure 47-6

How Remote Printing Works

Figure 47-7 on page 907 shows what happens when a user on a SunOS 5.x print client submits a print request to a SunOS 4.1 print server. The lpsched daemon handles the local part of the print request, and the lpNet daemon and its child process handle the network communication between the two systems.

Графика

Figure 47-7

a SunOS 4.1 Print Server
Figure 47-8 on page 909 shows a SunOS 4.1 print client submitting a print request to a SunOS 5.x print server. The lpd daemon handles the local part of the print request and the connection to the print server. The network listen process, which resides in the Service Access Facility on the server, waits for network printing requests and sends them to the lpNet daemon. The lpNet daemon and its child processes hand the request over to the lpsched daemon, which processes the request on the print server.

Графика

Figure 47-8

SunOS 5.x Print Server
Figure 47-9 on page 911 shows what happens when a user of a SunOS 5.x print client submits a print request to a SunOS 5.x print server. The lpsched daemon on the print client handles the local part of each print request. Then lpsched passes the request to the lpNet daemon on the print client, which spawns a child process that communicates with the print server.
The Service Access Facility network listen service on the print server monitors network printing requests and sends them to the lpNet daemon on the print server. The lpNet daemon and its child processes send the request to the lpsched daemon on the print server, which processes the print request.

Графика

Figure 47-9

and a SunOS 5.x Print Server

Customizing the LP Print Service

Although the LP print service is designed to be flexible enough to handle most printers and printing needs, it does not handle every possible situation. You may have a printing request that is not accommodated by the standard features of the LP print service. Or you may have a printer that does not quite fit into the way the LP print service handles printers.
You can customize the LP print service in the following ways:
  • Adjust the printer port characteristics
  • Adjust the terminfo database
  • Customize the printer interface program
  • Create a print filter
  • Define a form
See Chapter 51, "Customizing the LP Print Service," for detailed descriptions and step-by-step instructions to customize the LP print service.