[ Team LiB ] Previous Section Next Section

Introducing the LP Print Service

The LP print service is a set of software commands that enable users to print files while they continue to work. The print service consists of the LP print service software and spooler—spool is an acronym for system peripheral operation off-line. The LP print service performs the following functions.

  • Administers files and schedules local print requests.

  • Schedules network requests.

  • Filters files (if necessary) so that they print properly.

  • Starts programs that interface with the printers.

  • Tracks the status of jobs.

  • Tracks forms mounted on the printer.

  • Tracks print wheels that are currently mounted.

  • Delivers alerts to mount new forms or different print wheels.

  • Delivers alerts about printing problems.

Administering Files and Scheduling 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, as shown in Figure 23.

Figure 23. The lpsched Scheduler Updates the LP System Files

graphics/11fig01.gif

Starting with the Solaris 2.6 release, all the LP commands except for enable and disable have been moved from /usr/bin into /usr/sbin. The enable and disable commands are located in /usr/bin and /usr/lib/lp/local and are symbolically linked to the accept and reject commands.

The lpsched daemon also schedules all local print requests, as shown in Figure 24, regardless of whether the requests are issued by users 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 one is in the queue.

Figure 24. The lpsched Scheduler Schedules Local Print Requests

graphics/11fig02.gif

graphics/new.gif

Each print client and print server must have only one LP scheduler running. Starting with the Solaris 9 release, the scheduler is started by the lpadmin command when a local printer is added to the system and stopped when the last local printer is removed from the system. Without rebooting the system, you can stop the scheduler with the /usr/sbin/lpshut command and restart the scheduler with the /usr/lib/lp/lpsched command. The scheduler for each system manages its own print requests. It waits for requests issued by the LP commands and then handles the requests in an appropriate manner.

Scheduling Network Print Requests

Starting with the Solaris 2.6 release, the lpNet daemon does not schedule network requests. Instead, network scheduling is handled by the inetd Internet services daemon. The inetd daemon listens for a request and starts in.lpd. Then, in.lpd looks at the request and loads bsd_lpsched.so. in.lpd passes the request through bsd_lpsched.so to lpsched for local printing.

Filtering Print Files

Print filters are programs that convert the content of a file from one format to another so that it can be printed. In network printing, print filters process the file on the print client before it gets transmitted to the server. The LP print service uses filters to perform the following tasks.

  • Convert a file from one data format to another so that it can be printed properly on a specific type of printer.

  • Handle the special modes of printing that users may request with the -y option to the lp command—for example, two-sided printing, landscape printing, draft- or letter-quality printing.

  • Detect printer faults and notify the LP print service of them so that the print service can deliver alerts.

Not every print filter can perform all these tasks. However, because each task is printer-specific, it can be implemented separately.

A print filter can be as simple or as complex as needed. The Solaris Operating Environment provides print filters in the /usr/lib/lp/postscript directory to cover most PostScript printing situations in which the destination printer requires the data to be in PostScript format. You have to create and add filters to the system for non-PostScript printers.

Starting the Printer Interface Program

The LP print service uses a standard printer interface program to interact with other parts of the operating system to perform the following tasks.

  • 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 be careful that the custom program does not terminate the connection to the printer or interfere with proper printer initialization.

Tracking the Status of Print Jobs

The lpsched daemons on the print server each keep a log of every print request that is processed and note any errors that occurred 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 file lpsched .n 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 print job.

The following example shows the end of the /var/lp/logs/lpsched file.


# tail /varl/lp/logs/lpsched
06/01 14:51:50: Print services started.
06/01 16:52:27: Print services stopped.
06/02 15:43:44: build info: 01/08/00:18:06:11
06/02 15:43:44: Print services started.
06/02 17:04:25: Print services stopped.
06/04 10:34:00: build info: 01/08/00:18:06:11
06/04 10:34:00: Print services started.
06/04 16:53:05: Print services stopped.
06/05 09:34:59: build info: 01/08/00:18:06:11
06/05 09:34:59: Print services started.
#



Tracking Forms

The LP print service helps you track which forms are mounted on each printer and notifies you when it cannot find the description of how to print on a form. You are responsible for creating form descriptions and mounting and unmounting the paper form 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. You (root) can mount a specific form and then tell the LP print service that the form is available and on which printer it is mounted. Alternatively, users can submit print requests specifying a particular form and requesting that the form be mounted. When the LP print service receives the request, it sends an alert message to the system administrator (root) requesting that the form be mounted.

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 daisy wheels or print balls, 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 the system administrator (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 fix it. Users are notified when a print request cannot be completed. Users can request notification by e-mail when a job is successfully completed. Administrators are alerted to problems with printers and to 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 system administrator's console window (that is, to the terminal on which root is logged in).

As the system administrator, you can change the policy to receive alert messages by e-mail or a program of your choice. Or, you can choose to receive no alerts when printing problems occur.

    [ Team LiB ] Previous Section Next Section