United States-English |
|
|
HP-UX System Administrator's Guide: Overview: HP-UX 11i Version 3 > Chapter 3 Major Components of HP-UXPrinting |
|
Printing on HP-UX is accomplished through a subsystem known as the HP-UX Line Printer Spooling System. The Line Printer Spooling System (spooler) is a set of programs, shell scripts, and directories that controls your printers and the flow of data going to them. The spooler ensures that output from multiple users or processes doesn’t arrive on a printed page intermixed, yielding a printout that is useful to no one. With the line printer spooling system you can also:
To understand the flow of data through the spooler, think of it as a plumbing system, as shown in Figure 3-7. The data in the form of print requests (print jobs) enters the system like the “water” in the plumbing system. Directories known as print queues serve as temporary holding tanks for the print requests until they are sent to a printer to be printed. The print queues and the scheduler control the flow of print jobs to the defined printers: Accepting, rejecting, enabling, or disabling print requests controls the data flowing through the spooler as valves would control the flow of water in a real plumbing system. Based on the status of the various print queues and printers, the line printer scheduler (called lpsched) accepts incoming print requests, routing them to the print queues; and it functions as an automated flow controller in the “plumbing” system, routing print requests from the print queues to the physical printers on a first-in-first-out basis (while accounting for the priority of print requests and printers). Interface files (written as shell scripts) near the end of the data flow serve as pumps that “pump” the orderly flow of data to the printers.
If one printer’s “drain gets clogged”, you can reroute a print request from that printer to another by using the lpmove command. Unwanted data can be “flushed” from the spooling system with the cancel command. You can also send print requests to a printer configured on a remote system, using remote spooling. When you use remote spooling, a shell script (“pump”) sends data to a remote system via the rlp command. A remote spooling program (a daemon called rlpdaemon), running on the remote system, receives data and directs it into the remote system’s spooler. rlpdaemon can also run on your local system to receive requests from remote systems. Remote spooling is carried out by communication between the local spooler and the remote spooler. If some of your systems have printers configured and others do not (but all systems are networked), you can have the systems share use of available printers. To do so, set up the spoolers of the systems lacking printers to automatically send print jobs via the network to the spooler of a system equipped with the printer. The rlpdaemon program runs in the background of the printer’s system, monitoring the incoming network traffic for remote print requests from other systems. When these requests arrive, the rlpdaemon submits them to its local spooler on behalf of the remote user. In addition to handling remote print requests, rlpdaemon handles cancel and status requests from remote systems, using special interface scripts much like printer interface scripts. Configuring a remote printer into your spooler requires that you supply the following additional information beyond what you supply to configure a local printer:
To configure remote spooling, see HP-UX System Administrator’s Guide: Configuration Management. Printer interface files are special script files used by the spooler to communicate with the printers during the actual printing of a print job. These interface files are very specific to the type of printer they are sending data to and they can be customized, for example to provide unique banner/separator pages. HP-UX provides a library of sample files corresponding to most HP printers (or printer families) -- examples: “laserjet”, “colorlaserjet”, “PCL5” -- and some sample files corresponding to generic printer families (for example “postscript”). When you set up a printer in the line printer spooling system (whether through a tool like the System Management Homepage or directly by using the shell based lpadmin command), you specify a printer model script to be associated with the printer you are setting up. A copy of the specified model script (one of the previously mentioned sample files) is copied from the /usr/spool/lp/model directory into the /usr/spool/lp/interface directory (which is actually a symbolic link to the directory /etc/lp/interface[5] where the copy will physically reside). Printer model files are required in the following procedures:
The model scripts are ASCII files that you can read to find one that matches the printer's capabilities. Protocols like the Printer Command Language (PCL) or PostScript are understood by many non-HP printers as well. The printer's user guide may reveal details like the PCL language level supported by the printer that are necessary to find the model script that allows to make the best use of the printer's features. Even model scripts written to support a specific printer type might not support all features offered by it. Therefore, they might benefit from customizing. The scripts can be edited though it is probably better practice to copy one to a file of a new name and edit the copy (in order to prevent your customization from being overwritten should a new version of the original script be delivered in a future update to HP-UX). If there is no model file to match the protocol used by your printer, the one named "dumb" offers some basic functionality and should work with most non-HP printers. There is also a "dumbplot" model script for plotters. The /usr/sbin/lpadmin command copies the identified model script to /etc/lp/interface/printername. See lpadmin(1M) for information on the command options. A local printer is physically connected to your system. To configure a local printer, see HP-UX System Administrator’s Guide: Configuration Management (Chapter 6: Configuring Printers). A remote printer may be physically connected or simply configured to a computer and accessed over a network. To access the remote printer, your system sends requests over the network to another system. To configure a remote printer into your local spooler, you must be able to access the remote system via the network. To configure a remote printer, see HP-UX System Administrator’s Guide: Configuration Management (Chapter 6: Configuring Printers). A network-based printer differs from a remote printer in that it is connected directly to the network rather than to a server. Network printers do not use device special files, but have their own IP address and LANIC identification. To configure a network-based printer, see HP-UX System Administrator’s Guide: Configuration Management (Chapter 6: Configuring Printers). When you configure a printer into the spooler, you assign it a printer name, to which you direct print requests. A printer name may have up to 256 alphanumeric characters, however for maximum compatibility with other subsystems that interact with the spooler try to keep the names to 14 characters. Printer names may include underscores. The following are sample valid printer names: laser1, letterhead, invoices, check_printer. The printer names you assign are listed in the directory /usr/spool/lp/interface. Each file in that directory is a copy of the model file (printer interface script) that enables you to print to the named printer. You can make efficient use of multiple printers by grouping them as though logically they were a single printer. To do this, you create a printer class. A printer class is a collective name for a group of printers. The printer class is retained in the directory/usr/spool/lp/class. For example, the sample printers named laser1 and letterhead might be assigned a printer class called “VIP”, while the printers named invoices and check_printer might be assigned a printer class called “accounts”. A printer can belong to more than one class, however remote printers cannot belong to a printer class. It is not necessary to have every printer be part of a class; you can have some of your printers grouped in classes while others remain independent. To use a printer class you direct print requests to the class, name rather than to a specific printer. The print request is spooled to a single print queue and printed by the first available printer in the class. Thus, printer usage can be balanced and reliance on a particular printer can be minimized. To create a printer class, see the procedure “Creating a Printer Class” in the HP-UX System Administrator’s Guide: Configuration Management (Chapter 6: Configuring Printers). Also see the procedures “Removing a Printer from a Printer Class” and “Removing a Printer Class” in the same chapter. The print destination is the printer or printer class where a file containing the print job will be queued. Several commands for the spooler require you to specify a print destination. You can appoint one print destination in your spooler to be the system default printer. Each user can also personalize which printer is their default printer by setting a shell environment called LPDEST. When LPDEST is defined in a user’s environment, the printer represented by that variable takes precedence over the system default printer. Example 3-3 Default Printer (example) For example, if the system default printer for a server is defined as laser1 and a user has defined the environment variable LPDEST with the value ceo_print, then unless the user specified a print destination their print requests will be sent to the destination ceo_print. A different user on the same server with no LPDEST environment variable defined will have their print jobs directed to laser1 unless they specifically identify a print destination. In an environment where there is a lot of competition for a given printer or group of printers, the line printer spooling system offers several ways to prioritize print jobs so that critical print jobs can effectively “jump to the head of the line”. Both printers and print requests have priority values associated with them. Typically, print requests are handled by a printer in the order they are received. By default, print requests have the printer’s default priority and are printed on a first-in-first-out basis. However, print jobs can be assigned priority values to raise or lower their priority, using the -p option of the lp command. Priority values range from 0 to 7, with 7 being the highest priority. See lp(1) for details. The priority of a print request can be altered by using the lpalt command. A printer’s default request priority can be set using the lpadmin command. See lpadmin(1M) and lpalt(1) for details. If multiple print requests are waiting to be printed on a specific printer and all have priorities high enough to print, the printer will print the next print request with the highest priority. If more than one print request has the same priority, print requests with that priority will print in the order they were received by the spooler. Similarly, a priority fence value can be assigned to each printer to set the minimum priority that a print request must have to print on that printer. A printer’s fence priority is used to determine which print requests get printed; only requests with priorities equal to or greater than the printer’s fence priority get printed. The idea is to lower the fence outside peak usage hours, perhaps via crontab scripts. For more information, see crontab(1M) and cron(1M). This would allow low priority print jobs submitted during the day to be printed in the evening when the fence priority was lowered. See lpadmin(1M) and lpfence(1M) for additional details. Every spooling system request is logged in a log file located in /usr/spool/lp/log. The file contains a record of each spooling system request, including request ID, user name, printer name, time, error messages, and reprints due to failure. These are the commands associated with the line printer spooling system and a summary of what they do. See their respective manpages for complete details. In addition to these commands, most features of the spooling system can be controlled using one of the system administration tools such as the System Management Homepage.
If you have configured your HP-UX system to use LDAP-UX Client Services, the daemon ldapclientd initializes printer configurator services when it starts running. Printer configurator services will periodically scan an LDAP Directory Server for printer entries. If it finds any, it will extract the necessary information to compare against printers currently configured in the local spooler (on the client system). If the Printer Configurator Service discovers that new entries for printers have been configured on the LDAP Directory Server, the printer configurator service will configure those new printers into the local spooler automatically. If Printer Configurator Service discovers printer configuration entries have been removed from the LDAP Directory Server, the Printer Configurator Service will automatically remove the corresponding entries from the local spooler. In this way, by configuring printers in one place (the LDAP server), you can automatically add printers to (or remove printers from) numerous client systems automatically.
[5] Because everything under the /usr mount point is supposed to be treated as read-only and the contents of the interface directory are supposed to be editable. See /usr in the section Key HP-UX Directories. |
Printable version | ||
|