Managing Printing

The basics of printing are pretty straightforward. You click a button or enter a command, and you receive output on a physical print device. At least that's what you hope happens. (Just in case it doesn't, printer troubleshooting is covered at the end of this "Managing Printing" section.) This chapter quickly moves beyond the basics and into detailed descriptions of the Solaris printing process.

Before getting into printing fundamentals, though, take a look at a few advantages to printing in Solaris 9:

  • The print scheduler, lpsched, no longer starts automatically on computers that do not have a local printer installed. This doesn't affect clients printing on a network; it just makes Solaris a bit more efficient by not running a service unless it's necessary (which lpsched isn't, unless a local printer is installed).

  • Solaris 9 supports the use of USB printers and comes equipped with a USB printer driver.

  • Printers can be managed by a name service, such as LDAP, NIS, or NIS+. This makes it easier to locate network printers if you are using one of these naming services.

Printing in Solaris is based around the Line Printer (LP) print service. The LP print service provides a standard set of UNIX-based print commands and enables you to manage printers both locally and through a name service. Solaris 9 also comes with the graphical Solaris Print Manager. Even though Solaris Print Manager enables you to manage both local and networked printers as well, the commands offered by the LP print service give you the best flexibility when managing printers.

Note 

Solaris 9 does not provide support for print servers defined as s5 (the System V print protocol), as previous releases of Solaris did.

Understanding Printing Fundamentals

To successfully print, a variety of items must be configured correctly. Of course, you need a printer, which is a physical hardware device. The printer must also be attached to some sort of printing manager, which is called the print server. Print servers can be a computer, such as a Solaris or other UNIX-based machine. A print server can also be integrated as a service into a printer's network card or can be a small hardware device that's attached to printers or the network. Typically, the print server is the device to which the printer is physically connected. Regardless of its physical location, the print server manages the printer. For the sake of ease, this chapter assumes that print servers are Solaris-based unless otherwise specified. Solaris print servers use the BSD protocol, which includes support for SVR4 (LP) print standards as well as BSD lpd-based print standards.

In a networked environment, you will have one or more print servers and many print clients. A print client is any machine that prints to the print server. In a stand-alone environment, the print client is the same computer as the print server.

Print clients do not have a local printer installed (unless they are the print server as well). When a print request is submitted on a print client, the print command checks print configuration sources to locate a print server. After a print server is located, the print client sends the print request. It's then the job of the print server to direct the request to the appropriate printer.

Here are some resources that print clients can check for printer locations:

  • A user's LPDEST or PRINTER variables

  • A user's $HOME/.printers file

  • The local /etc/printers.conf file for the NIS name service

  • An LDAP or NIS/NIS+ name service database

Print clients do not have their own local print queue. Locating the print queue only on the server reduces the client's print overhead and reduces the chances of having printing problems.

One software component required to print is the print driver. Print drivers vary based on make and model of the printer, and they tell the operating system how to communicate with the printer. To function properly, the print driver must be specifically written for Solaris.

The last component is also software based, and it's the print spooler. Print spoolers reside on the print server. Their job is to accept print jobs, format them as necessary for the printer, and direct them to the printer. You will often hear people refer to the print spooler as a print queue. Although most of the time the terms are interchangeable, the print spooler does much more than hold (queue) print jobs. In Solaris, the print spooler is represented as the LP print service. Figure 8.1 shows the relationship of the printing components.

click to expand
Figure 8.1: Print components on a network

You will also hear the terms local printer and network printer. A local printer is one physically attached to your machine. A network printer is a printer that you can access but that is not located on your machine. Although Sun likes to define a network printer as one attached directly to the network (via its own network interface), we will assume that a networked printer is simply available "somewhere" on your network.

Using the LP Print Service

Originally known as the LP spooler, the LP print service is a set of files and utilities that provides print functionality in Solaris. The LP print service encompasses print software as well as print hardware.

The core files of the LP print service are located in the directories shown in Table 8.1.

Table 8.1: LP Print Service Directories

Directory

Contents

/etc/lp

More directories containing LP server configuration files.

/usr/bin

LP print service user commands.

/usr/lib/lp

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

/usr/lib/print

The in.lpd daemon and the printd daemon. The printd daemon transfers all waiting print jobs to the /var/spool/print directory once per minute. If there are no jobs, printd will not be running.

/usr/sbin

LP print service administrative commands.

/usr/share/lib

The terminfo database directory.

/var/lp/logs

Logs for LP activities.

/var/spool/lp

Spool files. This is the print spooling directory.

/var/spool/print

LP print service client-side request staging area.

The /etc/lp directory contains most of the subdirectories that hold the printer's configuration information. This includes printer classes, filters and forms, directories for each local printer, and links to the log files as well as the /usr/lip/lp/model directory. Although you can directly open and examine the files in /etc/lp, you should not edit them to make printer configuration changes. Instead, use the lpadmin command.

Each of the directories listed in Table 8.1 is important to the printing process. However, if you were to pick two directories that were the most important, they would be /etc/lp (discussed in the preceding paragraph) and /var/spool/lp. The /var/spool/lp directory is the print spool directory, which holds print jobs until they are printed. If this directory runs out of disk space, printing will either become incredibly slow or cease altogether.

Another important print-related area is the terminfo database, located in /usr/share/lib. The terminfo database is a series of directories that contain definitions for many types of printers. LP uses terminfo to initialize and communicate with printers. If your printer is not supported by Solaris, you can add your own terminfo entry.

Note 

Adding custom terminfo entries is beyond the scope of this Study Guide. For more information, please see System Administration Guide: Advanced Administration, by Sun Microsystems. You can access it at http://docs.sun.com/db/doc/806-4074.

Printing Commands

Although Solaris provides the graphical Solaris Print Manager, you need to be familiar with the commands used by the LP print service in order to pass the exam. Table 8.2 lists the commands you should know.

Table 8.2: Solaris Print Commands

Command

Description

accept

Enables the printer to receive print requests

cancel

Cancels a print request

disable

Deactivates one or more printers

enable

Activates a printer

lp

Sends print jobs to a printer

lpadmin

Printer administration command, used for configuration changes

lpfilter

Sets up or changes filter parameters

lpmove

Moves print requests from one location to another

lpsched

Starts the LP print service scheduler

lpstat

Shows the status of the LP print service

lpshut

Stops the LP print service scheduler

lpusers

Sets or changes the printing queue priorities

reject

Prevents the printer from receiving print requests

To use the print commands (other than lp), you must have root permissions, be logged in as the lp user, or be able to assume an equivalent role. As this chapter progresses, each command will be discussed in greater detail.

Print Service Log Files

The LP print service keeps two logs. One is a list of current print requests that are in the print queue, and the other is a historical register of print requests. To enable print logging, add the lpr.debug variable to the /etc/syslog.conf file. In Solaris, there are two types of print logs: queue logs and history logs.

Queue Logs

When you submit a print job to the printer, the print scheduler keeps two copies of your print request in queue log files. One is in /var/spool/lp/tmp/system_name and is accessible to the user who submitted the print job. The other copy is in /var/spool/lp/requests/system_ name and is accessible only by the root or the lp user.

The information in the queue logs will be present only as long as the job is in the print queue. When the print job is finished, its information is combined and appended to the /var/lp/ logs/requests file. Because jobs are in the print queue for only a short time, you have only a brief amount of time to look at the logs. Consequently, they're usually not too much help in troubleshooting unless a job is stuck in the print queue.

History Logs

There are two print history logs in Solaris: /var/lp/logs/lpsched and /var/lp/logs/ requests. The lpsched log contains information about current local printing requests, and requests holds information about completed print jobs that are no longer in the queue.

For troubleshooting purposes, the requests log is the more helpful of the two. It keeps track of a host of information, including the name of the printer, the name and the number of copies of the printed file, the type of content in the file, the name of the user who printed the file, and the outcome of the print request. Although analyzing the requests log is beyond the scope of this book (and the test), it can be useful for identifying abusers of print privileges. For more information on reading the /var/lp/logs/requests file, see the System Administration Guide: Advanced Administration.

As you might imagine, log files can get quite large. Consequently, the LP print service uses a cron job, /var/spool/cron/crontabs/lp, to periodically clean out old lpsched and requests log files. Three log files are kept for each: one current file and the two most recent histories. The current log file is renamed log.1, and log.1 is renamed to log.2. The information contained in log.2 is overwritten.

The Printer Interface Program

To interface with other parts of the operating system, the LP print service uses the standard printer interface program, located in /usr/lib/lp/model. The standard interface program is responsible for initializing the printer port with the stty (standard terminal) command, if necessary, and initializing the printer, printing banner pages, and printing the correct number of copies.

If the standard printer interface program does not sufficiently meet your printing needs, you can create a custom program.

Scheduling Print Requests

The scheduler for the LP print service is a daemon named lpsched. This daemon not only schedules print jobs, but it also updates LP system files with any printer setup or configuration changes. The lpsched daemon is located in the /usr/lib/lp directory.

Print servers might have only one LP scheduler running. If multiple LP schedulers were to be started, the LP service would become confused and printing would be problematic.

For local print requests, the scheduling process is relatively straightforward. The scheduler looks in the print queue for a print request, applies any filters for proper formatting of the document, and sends the request to the printer. The process is repeated until no more documents are in the print queue.

Printing on the network requires a bit more interaction. Now instead of having only one computer handling print requests, one computer makes the request, and another, the print server, receives the request. Print servers listen for print requests on the network with the Internet services daemon (inetd). After inetd receives a request, it starts the protocol adapter daemon, in.lpd. This daemon accepts the print request, translates it, and sends it to the print spooler. After the job is handed to the spooler, the print process is identical to local printing.

Each print request, whether local or remote, is logged and tracked by lpsched. The log file used is /var/lp/logs/lpsched. As mentioned previously in the "Print Service Log Files" section, log files can be helpful for tracking down printing problems.

Setting Up Printers

If you have only one Solaris computer and one printer, deciding where to place the printer is merely a matter of finding enough desk space. In a networked environment, though, you need to decide where to place printers so as to provide the required print access. Your decisions will be based on the number of printers you have, the number of users you have, and the printing needs of those users. Does the boss get her own printer, while 100 employees share another? Or does everyone share two printers? It would be impossible to provide the answer to every printer location solution. It's best to do what makes the most sense based on your company's printing needs.

In some cases, it makes sense to have all printers in one central location. That way, when users print, they can walk to the printer area and find their print jobs. In other companies, it makes more sense to give each department its own printer or two. In this case, printing is decentralized.

Whether you choose centralized or decentralized printing, you need to pick at least one computer that will function as the print server. You can choose to have more than one print server on the network, and there are advantages and disadvantages to multiple print servers. One disadvantage is potential confusion. You will need to educate users on where the printers are located. Many users won't understand why some printers are connected to one computer and others to another computer. An advantage is fault tolerance. If one print server crashes for some reason, you will still have printers installed on another server, and printing can continue.

Configuring Print Servers

Solaris is flexible enough that print servers and print clients can be running different versions of the Solaris operating environment and still function properly. Moreover, Solaris can operate as a print client or server with other operating systems, provided the other operating system supports lpd-based print standards.

Any networked computer can be a print server for the network. It doesn't necessarily need to be a machine that's otherwise designated as a server. Whichever machine you choose to be the print server just needs to have enough resources to handle the printing load.

Here are some of the requirements for print servers:

Disk space Acting as a print server isn't terribly resource intensive, but disk space is the most critical resource. The printer spool file will be located on the hard disk, and the file system containing the print spool must never run out of space. On small networks with low printing requirements, only 25MB-50MB of disk space is needed. However, if the print server serves a large number of users, or printing requirements are high (for example, printing graphics or other large PostScript files), the print server might need close to 1GB of disk space.

The print spooler resides in the /var file system by default. The hard disk containing the mounted /var file system should be on the local computer in all cases. Never place the print server's /var on a remote machine, or printing will be unacceptably slow.

Spooling space Spooling space runs hand in hand with disk space. The spooling location is /var/spool/lp. As mentioned previously, the /var file system must never run out of hard disk space. If it does, printing will either become incredibly slow or fail altogether. If the /var file system is part of the root file system (/), you need to find adequate disk space to give /var its own partition.

Memory Printing in Solaris is not very memory intensive. If you have enough memory to run Solaris, you have enough memory to print in Solaris. In some cases, such as using print filters, more memory can streamline the printing process.

Swap space Because swap space is used only when physical memory runs short, swap space should not be a major requirement for Solaris printing. However, if you are short on physical memory, make sure that your swap space is large enough to handle printing. It really shouldn't be an issue, though.

Also ensure that all users who need to print to the print server can access the server on the network.

If you are using a network naming service such as LDAP, NIS, or NIS+, you can configure the naming service switch file, /etc/nsswitch.conf, to point your print clients to the naming servers. They can provide a centralized printer configuration information repository for all network clients. Using the naming service switch file along with the proper printer configurations stored on the naming servers enables print clients to automatically have print configuration information without having to add it to their individual systems.

Setting Printer Definitions

When you install a printer in Solaris, you need to define parameters describing the printer itself, as well as how the printer will handle certain types of print jobs. The printer's collective settings are known as printer definitions.

Printer definitions are set through either the lpadmin command or Solaris Print Manager. Although Solaris Print Manager is easier to use because of its graphical nature, it does have some limitations. For example, limiting user access to a printer can be configured through either method, but lpadmin provides greater flexibility. Also, printer classes and fault recovery cannot be configured through Solaris Print Manager.

Here are some of the available printer definitions:

Printer name When you install the printer, you must give it a name no longer than 14 characters. The name should be descriptive of the printer's function or location, can contain alphanumeric characters including dashes and underscores, and must be unique on the network.

Most networks establish a naming convention for their printers. Examples are prnacct and prneng, or acctprn1 and engprn1.

Printer description This information should be used to help identify the printer. This could be a physical or departmental location, the brand of printer, or any other information that might be relevant.

Printer port The printer port is the device to which the printer is attached. Solaris has default printer port names, based on the type of port that the printer uses:

  • Serial ports will be /dev/term/a or /dev/term/b.

  • Parallel ports will be /dev/printers/0 or /dev/ecpp0.

  • USB ports will be /dev/printers/[1-9].

The LP print service uses the standard printer interface program to initialize the printer ports.

Printer type This is the generic name for the printer. It will correspond to the terminfo database entry containing the printer's control sequences.

Note 

On IA-based systems, only the first port is enabled by default. To use more than one port, you must manually edit the device driver port configuration file for each additional port you want to use. The file path for serial port printers is /platform/i86pc/kernel/drv/asy.conf, and for parallel printers it's /platform/i86pc/kernel/drv/lp.conf.

Using Solaris Print Manager

The Solaris Print Manager can be used to set up print servers and print clients, and to manage installed printers. Solaris Print Manager is compatible with the LDAP, NIS, NIS+, and files naming services. Solaris Print Manager is started in one of three ways: from the Workspace Menu Tools Printer Administrator (right-click on your CDE desktop to get the Workspace menu), from the CDE desktop Applications Menu Applications System_Admin Printer Administrator, or by executing the /usr/sadm/admin/bin/printmgr command. The Solaris Print Manager's default window is shown in Figure 8.2.

click to expand
Figure 8.2: Solaris Print Manager

After you have chosen a computer to be the print server, attached the printer, and turned the printer on, you need to add the printer to Solaris. Open Solaris Print Manager and follow these steps:

  1. From the Printer menu, choose New Attached Printer. The New Attached Printer window appears.

    click to expand

  2. Add the printer's name and description, make selections from the drop-down menus, select options, and click OK when you are finished.

  3. Confirm that the printer exists in the Solaris Print Manager window.

    click to expand

  4. Complete the printer installation by verifying that it can print. Either print from the Print menu of the application of your choice (such as a text editor or StarOffice) or execute the following command.

     # lp -d printer_name filename 

To set up a print client, you can also use Solaris Print Manager. You would perform this from the print client, not the print server. Here are the steps:

  1. Open the Solaris Print Manager.

  2. From the Printer menu, choose Add Access to Printer. The Add Access to Printer window appears

    click to expand

  3. Add the name of the printer, the server name, and an optional description. If you want to make this printer your default printer, click the Default Printer check box to select it. Click OK to finish.

  4. Complete the printer installation by verifying that it can print. Either print from the Print menu of the application of your choice (such as a text editor or StarOffice) or execute the following command.

     # lp -d printer_name filename 

Note 

admintool can also be used to graphically add printers, but the Solaris Print Manager is the recommended interface.

Adding Printers from a Command Line

Solaris Print Manager provides an easy interface to add printers to Solaris and manage printers. There might be a time, though, when you don't have access to Solaris Print Manager and you need to add a printer to the computer. The following steps are for adding a parallel PostScript printer named tamago:

  1. Give the root ownership of the port.

     # chown root /dev/printers/0 

  2. Make sure that the root is the only one with administrative access.

     # chmod 600 /dev/printers/0 

    Note 

    These first two steps give root ownership to and exclusive access of the printer port. Although they're not necessary steps in order to configure a printer, if you fail to perform them, other users will have administrative access to the printer.

  3. Configure the printer name and port.

     # lpadmin -p tamago -v /dev/printers/0 

  4. Configure printer options, such as printer type, input type, and description.

     # lpadmin -p tamago -T PS -I postscript -D "Second Floor Water Cooler" 

  5. Configure the printer to accept print requests. Failure to perform this step will prevent printing.

     # accept tamago 

  6. Enable the printer. Failure to perform this step will prevent printing.

     # enable tamago 

    Note 

    The accept command enables the print queue to accept jobs. However, the jobs will sit in the queue unless the enable command is issued, allowing the queue to pass the print jobs to the printer.

  7. Check the status to ensure that the printer is available.

     # lpstat -p tamago 

    You want to see a message similar to the following:

     printer tamago is idle. enabled since Sat Sep 21 11:14:15 MDT 2002.   available. 

  8. Test printing to ensure that it works.

     # lp -d tamago filename 

Adding a print client from the command line is a shorter process. These steps are performed from the print client, and the print server must be configured and available.

  1. Add the printer, using the printer's name and the server name.

     # lpadmin -p tamago -s Q-Sol 

  2. Add a description, if desired, and set the printer as the default, if desired.

     # lpadmin -p tamago -D "My Printer" -d tamago 

  3. Check to verify that the printer is ready.

     # lpstat -p tamago 

  4. Test printing to ensure that it works.

     # lp -d tamago filename 

Command-line options for lpadmin and lpstat are covered in the following section, "Performing Printer Administration."

Performing Printer Administration

Performing daily management of printers in Solaris is all about knowing which commands are available, what each command does, and when to use the commands. If all goes well, you will simply set up printers and never have to worry about them. Inevitably, though, you'll have a problem that you need to resolve. The graphical Solaris Print Manager is handy for many administrative tasks, but for complete printer management, you will need to use the command line.

This section is about management tasks that you might need to perform and the commands that you will use to perform them. Where applicable, command-line options are included as well.

Checking Printer Status

If you want to determine which printers are available or to determine characteristics of installed printers, you can do so with the lpstat command. The syntax of lpstat is as follows:

 # lpstat -d [-p printer_name -D -l] -t 

For example, to show the status of a printer named kani, along with the printer's description, you would use:

 # lpstat -p kani -D 

The arguments for lpstat are listed in Table 8.3.

Table 8.3: lpstat Arguments

Option

Description

-d

Displays the system's default printer.

-p printer_name

Displays the status of the specified printer. Multiple printers can be specified, separated by commas.

-D

Displays the description of the specified printer_name.

-l

Displays the characteristics of the specified printer_name.

-t

Displays the status of the LP printing service and all installed printers.

Stopping and Restarting the Print Scheduler

If the print scheduler is stopped for some reason, you will need to restart it to get printing to work. Also, occasional printing glitches might occur when print jobs are sent but nothing prints. If investigating shows that the jobs are in the queue, but nothing is printing, then stopping and restarting the print scheduler can sometimes rectify this situation.

To stop the print scheduler, use:

 # /etc/init.d/lp stop or # /usr/lib/lp/lpshut 

To restart the scheduler, use:

 # /etc/init.d/lp start or # /usr/lib/lp/lpsched 

Note 

Technically speaking, the /etc/init.d/lp stop and /etc/init.d/lp start commands affect the entire LP print service, whereas lpshut and lpsched affect only the lpsched daemon. However, both sets are effective at stopping and restarting the print scheduler.

Configuring Printer Definitions

Printer definitions are essentially the variables that complete the printer's configuration. Many definitions can be set through the Solaris Print Manager, but not all. From the command line, most definitions are set with the lpadmin command. Here is the basic syntax for lpadmin:

 # lpadmin -p printer_name options 

lpadmin offers a large number of options. Some of the common ones are listed in Table 8.4.

Table 8.4: lpadmin Arguments

Option

Description

-p printer_name

Specifies the name of the printer to be modified.

-A alert_type

Defines an alert sent to the administrator when a printer fault is detected. Alert types include mail (e-mail the administrator), write (send a message to the administrator's terminal), quiet (do not send an alert about the current problem), and none (do not send messages at all).

-W minutes

Used with -A. Defines the number of minutes to wait between sending alerts to the administrator.

-c class

Adds the printer indicated by printer_name to the specified printer class.

-d printer_name

Specifies the default printer for the system.

-D comment

Adds a comment for the printer. For comments that have spaces, place the comment in quotes.

-f allow:form_list

Allows forms in the form_list to be printed on this printer. By default, forms are not allowed on new printers.

-f deny:form_list

Denies forms in the form_list to be printed on this printer.

-F fault_recovery

Specifies the recovery method to be used if a print request fails due to a printer fault. Options are continue, beginning, and wait.

-I content_list

Allows the printer to print requests with the content types listed in content_list. Separate multiple content types with commas.

-o option

Specifies default printer configuration values. Options include length, width, cpi (characters per inch), lpi (lines per inch), stty (port settings), protocol (for network printers), and banner and nobanner (for print banners). Examples follow this table.

-r class

Removes the printer from the printer class. If the printer is the last one in the class, the class is removed.

-s system_name

!printer_name

Makes a remote printer (one that would typically have to be accessed through another system) accessible to users on your system. The system_name option is the name of the remote computer, and !printer_name is the name of the printer on that system. An example follows this table.

-t trays

Specifies the number of trays available in the printer.

-T printer_type

Identifies the printer as being of a specific printer type, as defined by the terminfo database.

-u allow:login_ID

Allows the user or users listed by login_ID access to the printer. By default, all users are allowed access to the printer. Options for login_ID include system_name!login_ID, which enables a user from a remote system to access the printer, system_name!all, which enables all users from the named system to access the printer, and all, which gives access to all users on all systems.

-u deny:login_ID

Denies the user or users listed by login_ID access to the printer. The options for login_ID are the same as those for -u allow.

-v

Associates a device with a printer.

-x printer_name

Removes the printer.

As you can see in Table 8.4, lpadmin offers quite a range of functionality. Although in practice this is a good thing, understanding and memorizing all the options can be difficult. To help you understand lpadmin's usage, some examples follow.

To specify a description for the printer named mirugai, use the following command:

 # lpadmin -p mirugai -D "Near the stairs on the first floor" 

To make mirugai your default printer, you could use:

 # lpadmin -d mirugai 

Also, default printers can be specified by LPDEST and PRINTER environment variables (depending on the user's shell), and the _default variable in the user's $HOME/.printers file. To verify a system's default printer, use:

 # lpstat -d 

Banner pages are useful on networks with a large amount of print traffic. If multiple users share a printer, print jobs are generally processed in the order they are received, except for priority jobs. Because of this, waiting for a print job on a busy printer could take a while, and print jobs build up in the printer's output tray. Banner pages print the user's name, making it easy to identify where a user's print job starts and stops (the next job will have a new banner page).

The negative aspect to banner pages is that they waste paper. If they're not necessary on your network, it's best to disable them because they're enabled by default. To disable print banners on your printer, use:

 # lpadmin -p printer_name -o banner=never 

To enable banners, but give your users the option of disabling them, use:

 # lpadmin -p printer_name -o banner=optional or # lpadmin -p printer_name -o nobanner 

Finally, to require users to use print banners, use:

 # lpadmin -p printer_name -o banner=always or # lpadmin -p printer_name -o banner 

The last printer definition to discuss is invoked with the -s option. It enables users on your computer to print to a printer that is defined on another computer. This command can be helpful if your computer is a print server, but for some reason you are having problems printing. You can then tell users to print to the new printer you defined. Consider this example: Your computer is named locoduck. An associate's computer is named sushiyum, and his printer is named maguro. You want to define his maguro printer on your computer as daffy. Here's how you would do it:

 # lpadmin -p daffy -s sushiyum!maguro 

Users will now be able to print to your daffy printer, after you have configured it to accept print jobs and enabled it. The print output will be physically on the maguro printer.

Using Printer Classes

By using the lpadmin -c command, you can group multiple locally attached printers into a printer class. When users print, they specify the name of the class instead of the name of the individual printer. Printer class names must meet the required specifications for printer names (no more than 14 alphanumeric characters).

Using printer classes increases the efficiency of your printers. For example, say that your company has three laser printers. One of the laser printers is constantly busy, and users are waiting for print jobs. Another laser printer is moderately busy, and the third is rarely used. With a printer class, print jobs would be distributed evenly among the three laser printers. This is because a print job entering the queue is sent to the first available printer, the second job to the second printer, and so forth.

If you do enable printer classes, be sure to place all printers in the class in the same physical location. Otherwise, users will have to adventure throughout the office looking for their print jobs.

Solaris does not place a limit on the number of printers in a class, nor is there a limit to the number of printer classes that you can create. To add the printer named ika to the officeprinters class, you would use:

 # lpadmin -p ika -c officeprinters 

Printer class information is stored in the /etc/lp/classes/printer_class file. If the file does not exist when you add a printer to the class, the file is created automatically.

Enabling Fault Alerts and Fault Recovery

You can choose to have the printer notify you, via fault alert, if printer errors are encountered. Fault alerts are enabled through the lpadmin -A command or Solaris Print Manager. The three most popular options for fault alert notifications are sending a message to the computer where the root user (or other specified user) is logged in, sending an e-mail to the root user (or other specified user), or running a command if an alert state is encountered. The command would likely be a small program designed to rectify the situation, such as shutting down the printer and redirecting print jobs, or stopping and restarting the LP print service.

Fault recovery is a slightly different thread and is enabled with the lpadmin -F command. Fault recovery specifies what to do with the current print job if a printer fault is detected.

The three options for fault recovery are to restart printing of the job from the beginning, to continue printing from the top of the page when the fault was detected, or to wait for you to re-enable the printer and then continue to print from the top of the page where the printing stopped. Table 8.5 summarizes the fault alert and fault recovery options.

Table 8.5: Fault Alert and Fault Recovery Options

Option

Description

lpadmin -A "mail username"

E-mails the specified user, or root if no user is specified.

lpadmin -A "write username"

Writes a message to the console where the root is logged in, or to the console where the specified user is logged in.

lpadmin -A quiet

Does not notify for that specific printer fault.

lpadmin -A command

Executes the command when a printer fault is detected.

lpadmin -A none

Does not send any alerts for any print faults.

lpadmin -W minutes

Waits a specified number of minutes between sending fault alerts. Used in conjunction with the -A switch.

lpadmin -F beginning

Starts printing from the beginning of the file after a printer fault recovery.

lpadmin -F continue

Starts printing from the top of the page where the printing stopped after recovering from a printer fault.

lpadmin -F wait

After a fault recovery, waits to print until the printer is enabled by the administrator. Then, starts printing from the top of the page where the printing stopped.

Fault alert settings are maintained in the /etc/lp/printers/printer_name/alert.sh file. Fault recovery settings are noted in the /etc/lp/printers/printer_name/configuration file.

Limiting User Access

By default, all users have printing rights on newly created printers. As a printer administrator, you can control user access to printers with the lpadmin -u command on the print server.

Note 

Solaris Print Manager lets you create Allow lists only. To create Deny lists, you must use lpadmin -u.

As the names of the lists imply, an Allow list lets specified users access the printer, whereas a Deny list prohibits users from printing to the printer. Allow and Deny lists are created on the print server. When you have created one or both types of lists, sorting out who has what printing rights can be a bit confusing. Here are the rules for Allow and Deny lists:

  • If you leave both lists empty or have not created lists, all users have access to the printer.

  • If you specify all in the Allow list, everyone can access the printer.

  • If you specify all in the Deny list, everyone is denied access to the printer, except for root and lp.

  • If you add an entry to the Allow list, the Deny list is ignored. Only users specified in the Allow list (along with root and lp) have access to the printer.

  • If you create an entry in the Deny list, but you do not create an Allow list or you leave the Allow list empty, users in the Deny list do not have access to the printer.

Here is the syntax for creating an Allow list:

 # lpadmin -p printer_name -u allow: user_list 

If you are specifying multiple users, separate usernames with a comma. To create a Deny list, simply replace allow with deny in the preceding example. The Allow list is maintained in /etc/ lp/printers/printer_name/users.allow, and the Deny list is in /etc/lp/printers/ printer_name/users.deny.

Managing Print Requests

After a user has submitted a print job, the print job is held in the print queue until the printer is ready for it. While the job is in the queue, the print administrator can place the job on hold or change its priority so that it's the next one to print. These actions are performed from the print server with the lpadmin -H command. Options for lpadmin -H are hold, resume, and immediate. The hold option prevents a print job from printing, resume enables a held print job to print, and immediate moves the print job to the top of the print queue.

Enabling and Disabling Printers

The enable and disable commands are used to allow a printer to print or to prevent it from printing, respectively. When a printer is disabled, it will not print. However, print jobs submitted by users will still be added to the print queue.

When a printer fault occurs, the printer might be disabled automatically. To allow the printer to continue printing, you must enable it.

To disable a printer named amaebi, you can use the following command:

 # disable -c -r "The printer is broken!" amaebi 

The disable command has three commonly used switches: -c, -W, and -r "reason". The -c switch cancels the current print job and then disables the printer. The -W switch waits until the current print job is finished and then disables the printer. For obvious reasons, -c and -W cannot be used at the same time. The -r "reason" switch gives the users a reason why the printer is disabled. Users will see the reason if they check the printer's status with lpstat -p.

To enable the amaebi printer, you would use:

 # enable amaebi 

You can enable or disable only specific printers. You cannot enable or disable printer classes.

Accepting and Rejecting Print Requests

The enable and disable commands affect the printer, whereas the accept and reject commands affect the print queue. As mentioned in the preceding section, if you disable a printer, the print queue can still receive print requests. To prevent the print queue from accepting requests, use the reject command. Even if the reject command is issued, print jobs already in the print queue will be allowed to print.

Only one argument is used with reject, and that is -r "reason". Its usage is exactly identical to the -r "reason" switch used with disable.

To reject print jobs for the printer unagi, you would use:

 # reject -r "Time for maintenance." unagi 

After the maintenance is complete, you could accept new print jobs by using this command:

 # accept unagi 

Canceling Print Requests

Print jobs can be cancelled by the user who submitted the print request or by the root or lp users. The cancel command is used to cancel print jobs. The current print job can be cancelled, and jobs can be cancelled by request identification number (request ID) or by user who submitted the job.

A print job's request ID is displayed when the job is submitted. However, if you've forgotten the request ID, you can see it by using the lpstat -o printer_name command. Request IDs consist of the printer's name, a dash, and the number of the print request. An example is unagi-19.

Here are some examples of canceling print requests. To cancel a print request for the user adocter, use:

 # cancel -u adocter 

Canceling the current print job on the printer requires only the printer's name, such as:

 # cancel unagi 

whereas canceling specific print jobs requires the request ID, as in:

 # cancel unagi-19 

Multiple print jobs or printers can be specified. Separate multiple identities with commas.

Moving Print Requests

Say that one of your printers, printer1, crashes unexpectedly. You have another printer defined on the same print server named printer2. Upon further investigation, you notice that the queue for printer1 has jobs in it, and users are submitting more jobs. What do you do?

Use the reject command to reject new print jobs for printer1, and take the jobs that are in the queue for printer1 and move them to printer2. To move print jobs, you don't need to know the request IDs; you just need to know the names of the printers involved. Print jobs are moved with the lpmove command. Here's the syntax:

 # lpmove from_printer to_printer 

When you use lpmove to move all print jobs from one printer, that printer automatically stops accepting print requests. However, it's still recommended that you use the reject command before moving print jobs. Here's an example of moving all print jobs from the unagi printer to the maguro printer:

 # lpmove unagi maguro 

Also, you can use lpmove to move specific jobs based on request ID.

Changing Print Request Priorities

Priorities affect the order in which print jobs are printed and, consequently, can be changed only by the root and lp user accounts. You can change the priority of submitted print requests in one of two ways.

The first method is one described earlier in this section, but it has limited flexibility regarding priorities. You can use lpadmin -H hold to hold print jobs, or lpadmin -H immediate to raise the print job to the top of the print queue. For more flexibility, use the lp command, as follows:

 # lp -i request_ID -H priority 

or

 # lp -i request_ID -q priority 

Because -H and -q both affect priorities directly, only one can be used at a time. If you're going to use lp -H, the same options apply as for lpadmin -H. However, lp -q enables you to specify a numerical priority, from 0 to 39. 0 is the highest priority, and 39 is the lowest. If you wanted to change the priority of the print job unagi-19 to 4, you would use:

 # lp -i unagi-19 -q 4 

Again, because of the potential for problems (print queue "battles"), only the root and lp users can change the priority of print jobs.

Using Print Filters and Forms

Print filters convert a raw print job into a format that's acceptable to the printer. Filters also can be used to detect print faults and are necessary to handle special printing modes such as landscape printing and double-sided printing.

Solaris provides some PostScript print filters in the /usr/lib/lp/postscript directory. If you are using PostScript printers, the provided filters are enabled automatically. For other types of printers, you will have to modify an existing filter or create your own.

Creating filters is beyond the scope of this book, and it often requires experimentation to work properly. For more information, you can start with the man page for the lpfilter command.

Print forms are for print jobs that will be printed on preprinted paper. Although the form refers to the physical paper that the job will be printed on, Solaris also defines the print form as the definition of the form (what to print and where) within the LP print service.

No print forms are supplied with Solaris. To create a print form, use the lpforms command. Print forms are stored in the /etc/lp/forms directory.

Deleting Printers

Finally, if a printer needs to be removed from service or moved to another print server, it should be deleted from the existing print server and all print clients. Once deleted, the printer can be added to the new print server (if necessary) and configured on the print clients.

  1. Before deleting a printer, ensure that all print jobs that have been sent to the printer are complete and that the printer cannot accept any new jobs. Printers should be deleted from print clients first. On the print client system, delete the printer.

     # lpadmin -x printer_name 

  2. On the print server, prevent any new requests form entering the print queue.

     # reject printer_name 

  3. On the print server, disable the printer when the queue is empty.

     # disable printer_name 

  4. Delete the printer from the print server.

     # lpadmin -x printer_name 

  5. Verify that the printer does not exist.

     # lpstat -p printer_name 

    You should receive a message that the printer does not exist.

start sidebar
Real World Scenario: Printing Errors

Your network has been running relatively trouble-free for the last few years. Recently, you purchased a new Solaris 9 server to replace one of your older Solaris servers. This new server will be a file and print server.

In an effort to consolidate printing resources, management has decided that everyone should print to the same print server. This includes the engineering department, which frequently prints blueprints on a plotter. You have the proper instructions for installing and configuring the plotter, and the plotter manufacturer has provided a Solaris driver for the device.

After a few days of using your new print server and printing configuration, you start getting occasional calls from users complaining that printing is unacceptably slow. Every once in a while, a user gets an error message about being out of memory when attempting to print. Sometimes they can try again and get it to work, but other times it takes multiple retries to print. Even when it does work, again, it's slow.

It's your job to find a solution to this printing problem.

Whenever printing is slow or users get memory errors while printing, it's a good sign that the print spooler is low on space. If the file system that contains the spool file (/var) is low on space, it will attempt to use virtual memory, which is on the hard disk. Although this works, it will slow down printing dramatically.

The first thing to check is the availability of space on the /var file system. In many cases, /var is placed on the same file system as the root (/), which is a definite problem for a print server. It's best to install a separate hard disk simply for /var, if possible. This is especially true if you have users who regularly print large files, such as blueprints or lengthy reports.

This is one problem that shouldn't be too hard to fix; it's just a matter of getting the right configuration, and enough room, for the print spooler.

end sidebar

Troubleshooting Printing

In an ideal computing world, you will never have printing problems. As of yet, though, no one has discovered or created the ideal computing world.

Printing problems can vary. Perhaps you sent a print job to the printer, but nothing prints. Maybe something does print, but it's unintelligible garbage. Or possibly you've entered a command and received absolutely no response. Fixing these problems is just like troubleshooting anything else on a computer. You need to find out what works, what doesn't, and narrow down the possible problem points to isolate the issue.

Nothing Is Printing

You send a print job, and nothing happens. You don't get an error message, yet you don't get your print job either. One of three things is usually the culprit: the printer, the LP print service, or the network (if applicable).

One of the first axioms in troubleshooting is, "Check the hardware." Everyone rolls their eyes at this statement, but checking the hardware is a critical first step. People often feel silly for checking things such as the power switch, but if the power is off, well, you might have found the problem. Also double-check the printer cables. Make sure that the data cable is securely fastened at both ends and that it doesn't appear to have any damage.

Check the LP print service next, because if it is not running, it needs to be. Also, the printer must be accepting print requests and be enabled to print. For other LP print service problems, you might want to enable the lpr.debug variable in the syslog.conf file or examine the lpsched log.

If the LP print service appears to be running and configured properly, you might want to stop the service and restart it. This "rebooting" of the service might fix your problem.

To stop the print scheduler, use:

 # /usr/lib/lp/lpshut 

And to restart the scheduler:

 # /usr/lib/lp/lpsched 

Or to stop and restart the LP print service, use:

 # /etc/init.d/lp stop # /etc/init.d/lp start 

For network printing problems, finding the solution gets more complex. Again, the first thing to check is hardware. Are all cables plugged in (including network cables), and is everything powered on? If so, can you access the print server from the print client? Can someone sitting locally at the print server print? These are all good questions to ask.

Also check for printer faults or unresponsive print filters if the printer is on but seems stuck. Find out what works and what doesn't, and narrow down the problem from there.

Output Is Incorrect

If you are getting output from the printer, yet it's not the output you expected, you can be assured that the hardware is configured correctly. All cables are attached, and the power is indeed on.

Incorrect print output is more often than not a function of an incorrect configuration. If you chose the wrong printer type, the incorrect file content type, or incorrect port settings when you installed the printer, it's possible that your output will not be correct.

Note 

If your banner page prints, but nothing else is correct, it's a good sign that you have an incorrectly configured file content type.

LP Commands Are Unresponsive

You just entered an lpadmin command to change a printer definition but you received no reply. Finding the lack of response odd, you use lpstat to check the status of your printer. Again, you get no response. Chances are good that your LP print service is hung. Stop and restart the service, and the problem should go away. If it doesn't, you might need to uninstall all printers (thereby removing the LP print service) and reinstall them.




Solaris 9. Sun Certified System Administrator Study Guide
Solaris 9 Sun Certified System Administrator Study Guide
ISBN: 0782141811
EAN: 2147483647
Year: 2003
Pages: 194

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net