Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
HP-UX System Administrator's Guide: Overview: HP-UX 11i Version 3 > Chapter 3 Major Components of HP-UX

Printing

» 

Technical documentation

Complete book in PDF
» Feedback
Content starts here

 » Table of Contents

 » Glossary

 » Index

Printing on HP-UX is accomplished through a subsystem known as the HP-UX Line Printer Spooling System.

Overview of 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:

  • Give priority to print requests from certain users/processes

  • Group printers so that they share a common input print queue

  • Give priority to some printers over others

  • Define a system default printer (to be used whenever a print request does not specify a print destination)

  • Control the acceptance or rejection of incoming print requests to specific print queues

  • Control the printing of jobs that have already been submitted

  • Submit print requests to spoolers on remote systems (remote printing of local jobs)

  • Accept print requests from spoolers on remote systems (local printing of remote jobs)

  • Cancel previously submitted print jobs

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.

  • the commands accept and reject control the flow of print requests into the print queues

  • the commands enable and disable control the flow of print requests out of the print queues to the printers

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.

The line printer scheduler:

  • prevents intermixed listings

  • monitors printer/print request priorities

  • adjusts printer status and availability

  • logs spooler activities

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.

Figure 3-7 Line Printer Spooler “Plumbing” Diagram

Line Printer Spooler Plumbing Diagram

Remote Spooling

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:

  • name of the system with the printer

  • interface script to use when issuing a remote cancel request

  • interface script to use when issuing a remote status request

  • printer name, as defined in the spooler of the remote system

To configure remote spooling, see HP-UX System Administrator’s Guide: Configuration Management.

Network Printing

Network Printing refers to printing to a printer that is directly connected to the network, usually via an HP JetDirect interface card or built-in network connectivity. This is different from remote spooling in that another computer is not involved.

Printer Model Files and Interface Files

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:

  • Adding a Local Printer to the LP Spooler — see HP-UX System Administrator’s Guide: Configuration Management (Chapter 6: Configuring Printers)

  • Adding a Remote Printer to the LP Spooler — see HP-UX System Administrator’s Guide: Configuration Management (Chapter 6: Configuring Printers)

  • Adding a Network-Based Printer — see HP-UX System Administrator’s Guide: Configuration Management (Chapter 6: Configuring Printers)

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.

Printer Types

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).

Printer Name

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.

Printer Class

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.

Print Destination

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.

Priorities of Printers and Print Requests

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.

Printer Logging

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.

Summary of Line Printer Spooling System Commands

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.

lpadmin

lpadmin allows you to:

  • Add/remove printers to/from the spooler

  • Define printer classes

  • Set the default priority for a printer

lpsched

lpsched (the scheduler) is the heart of the line printer spooling system. When it is running, the line printer spooling system is considered to be running; when it is not running the line printer spooling system is considered to be not running. The lpsched command starts the scheduler running.

lpshut

Performing the opposite function of the lpsched command is the lpshut command. lpshut stops the scheduler and therefore stops all printing on all printers.

lp

The lp command submits a new print request to the line printer spooling system. When you want to print something from a shell environment (from a command line), use the lp command.

lpstat

The lpstat command reports the current status of the scheduler (“running” or “stopped”), whether or not a print queue (printer or class queue) is currently accepting new print requests, whether or not printers in the spooler are currently enabled, and which print requests are queued up or printing on each print queue.

lpmove

The lpmove command moves a print request from one print queue to another or to move all queued print requests on one queue to a different queue. The lpmove command can only be used when the scheduler is not running.

lpalt

The lpalt command allows you to change the attributes of specified print requests. Using lpalt you can:

  • Move specified print requests from one queue to another without having to stop the scheduler (Note: the print requests cannot be actively printing when you move them)

  • Change the priority of a queued print request

  • Change the number of copies that will print (of the specified print requests)

  • Change the print options (for example, change portrait to landscape printing) for queued print requests

  • Change the title that will print on a banner page associated with specified print requests

lpfence

Each print request has a priority (from 0 to 7) associated with it. The lpfence command, which can only be used when the scheduler is not running, specifies for a given printer the minimum priority a print request must have in order to print on the specified printer.

cancel

Cancels queued or printing print requests.

accept

Allows new print requests to be submitted to a print queue (associated with a printer or class).

reject

Prohibits new print requests from being submitted to a print queue (associated with a printer or class).

enable

Allows the printing of queued print requests to the specified printer.

disable

Inhibits the printing of queued print requests to the specified printer. If the print queue associated with the printer is still accepting new requests the requests will build up in the queue until the printer is again enabled. If the queue is associated with a class and other printers in the class remain enabled, disabling a specific printer only inhibits printing to that printer. Print requests coming to the class queue will still print on the other active printers in the class.

LP Spooler Integration with LDAP-UX

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.

NOTE: Even if a client system is configured to use LDAP-UX and its Printer Configurator Services, a system administrator can still configure printers in the client’s spooler manually.

For More Information on Printer-Related Tasks

Refer to the following documents for additional information:

  • HP JetDirect Network Interface Configuration Guide — for configuring network printers on the HP JetDirect Network Interface

  • LDAP-UX Client Services B.04.15 Administrator's Guide — for details on configuring LDAP-UX Client Services and the Printer Configurator Services



[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
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 2008 Hewlett-Packard Development Company, L.P.