Queue Management


CUPS provides for a very robust printing environment. To date, we have examined how to create queues to both local and remote printers. In this section, we concentrate on how these resources can be managed.

Before we delve into managing single queue characteristics, we need to explore some additional functionality available through CUPS.

The CUPS environment allows for additional flexibility when dealing with printers. Built into CUPS is the concept of a printer class. A class within CUPS is a collection of like printers. When a job is submitted to a class of printers, instead of a specific target, the first available printer in that class processes the output. In work areas where a number of similar printers are available, submitting a job to a class prevents small jobs from being queued behind slow printing jobs. As an example, emails could be printed to a class to avoid being stuck behind a large double-sided month-end report.

NOTE

As of the date this book was written, CUPS does not provide any indication of which printer within a class satisfies a print request. It is therefore imperative that like printers be grouped physically close to each other to reduce the amount of time spent going from printer to printer looking for output. This also means that sensitive documents should not sent to a printer class for printing. It is expected that CUPS version 1.2 will support such notifications.


CUPS extends the class construct to what it calls implicit classes. An implicit class is generated when a collection of servers is made to point to the same network printer using the same name. This also assumes that the printer is, in fact, a self-contained network printer, and not a local printer on a vulnerable server. In such environments, the failure of a single print server does not result in the loss of client access to the printer in question. CUPS further extends this concept to actual printer classes. If a job is submitted to a class, any server servicing that class can respond to the request.

An additional feature supported directly by CUPS is the possibility of defining multiple print queues that all point to the same physical printer. In many instances, software such as a web browser can force printout formatting. In some cases, such as with the command line, accessing double-sided print or two-up printing involves remembering a number of switches and parameters for the print command. It is possible to define distinct queues that have embedded in their configuration the desired formatting options. This alleviates the requirement of specifying option definitions in individual print requests.

YaST Queue Configuration

Figure 9.5 showed three items at the end of the Options list that do not have entries in the Current Values column. These options are actually placeholders for additional queue configuration options.

The first option is called Printing Filter Settings. Selecting this option allows you to configure how the output will be formatted, what media your output will be printed on, paper size, orientation, and so on. The options available vary from printer to printer. For a simple label printer, few options are available. High-end laser printers allow for the most section options.

When you are configuring multiple queues to point to a single printer, the Printing Filter Settings option allows you to define the default print options at the queue level. You can then present multiple queues to the users, each with its own characteristics.

The second option on the Edit Configuration window is Restriction Settings. By default, queues created on a system are available to all authenticated users. You can use this option to restrict access to specific users or, alternately, deny queue access to all but specific users.

The last option in Figure 9.5 is State and Banners Settings. With this option, you can control whether the printer is available to accept new printing jobs. In addition, if separation pages are required between printing jobs, you can configure pre- and post-job banner pages. For high-volume printing or in the case of the printing of sensitive information, banners can be used to separate jobs and facilitate their handling by the operations staff.

NOTE

Applications such as web browsers or editors often pass their own default printer configuration parameters to the target queue. These options override the configuration parameters set on the queue. The submitted job should print as expected by the software package even though the orientation and size of the output don't match the queue specification.


Command-Line Queue Configuration

All the configuration options available through the YaST interface are available from the command line as well. Unlike the YaST interface, the command-line configuration options are split into two different verbs.

The first printer configuration command is lpadmin. This command configures both printers and printer class objects. You can grant access to a specific printer using a single command such as

 Athena:~ # lpadmin p Laserjet u allow:hart,eric Athena:~ # lpadmin p Laserjet u deny:ted,pol 

In this example, Eric and Hart are granted explicit access to the LaserJet printer, while Ted and Pol are explicitly denied the use of this printer.

Table 9.2 summarizes the parameters that can be passed to lpadmin:

Table 9.2. lpadmin Parameters

CLASS MODIFIERS

PARAMETER

PARAMETER VALUE

PURPOSE

-c

class

Makes the printer a member of the class. Creates the class if necessary.

-r

class

Removes the named printer from class. Delete the class if it becomes empty.

CONFIGURATION MODIFIERS

-m

model

Sets a standard System V interface script or PPD file from the model directory.

-o

name=value

Sets a PPD option for the printer (for example, Duplex=None).

-o

job-k-limit=value

Fixes the maximum print job size in kilobytes.

-o

job-page-limit=value

Fixes the maximum number of pages printed.

-o

job-quota-period=value

Defines the length of a quota period in seconds.

-u

allow:user,user,@group deny:user,user,@group allow:all deny:none

Controls access to the printer by authenticated username.

-v

device-uri

Defines the printer interface (for example, parallel:/dev/lp0).

-D

Info

Provides a text description of the printer.

-E

 

Sets the printer to Enabled.

-L

Location

Provides a text string for the printer's physical location.

-P

ppd-file

Defines the filter file to be used for this printer.


After you configure a printer, you can use the lpoptions command to fine-tune the configuration. In contrast to the lpadmin command, the lpoptions command can also be used by an unprivileged user to save customized queue configuration parameters in a personal configuration file.

You can display configuration options for a particular printer by using the l option on the command, as the following illustrates:

[View full width]

Athena:~ # lpoptions -d Computer_Room_bj200 -l PageSize/Page Size: *A4 Letter 11x17 A3 A5 B5 Env10 EnvC5 EnvDL EnvISOB5 EnvMonarch Executive Legal PageRegion/PageRegion: A4 Letter 11x17 A3 A5 B5 Env10 EnvC5 EnvDL EnvISOB5 EnvMonarch Executive Legal Resolution/Resolution: 180x180dpi 180x360dpi 360x180dpi *360x360dpi Athena:~ #

Of course, the more advanced the printer, the larger number of configurable options. As an example, to set the default page size to letter format, you can use the following command:

 Athena:~# lpoptions -d Computer_Room_bj200 -o PageSize=Letter 

The lpoptions command sets the default queue characteristics for the local user. If the command is executed by the root account, the changes are made system-wide.

Printer Queue Basics

Above and beyond queue configuration verbs are the simple commands used to start, monitor, and stop queues. Though CUPS makes available a number of GUI tools for controlling queues, knowing the command-line versions can often save time and frustrations. This section offers a quick overview of some of the basics.

To submit a file to be printed, you use the lp or lpr commands. Both take a parameter d to specify the destination queue name if it is other than the default. Additional parameters are available and documented in the man pages. These defaults override the selections defined on the queue. A sample print job could look like this:

 Athena:~ # lp -d Laserjet -o landscape x-ray.log request id is Laserjet-9 (1 file(s)) Athena:~ # 

In the event of a printer malfunction, you often need to power-cycle the printer. If you do not do this correctly, or if the printer contains its own print server hardware, jobs could be inadvertently lost. To prevent this loss, it is often desirable to stop the queue from processing further jobs. To do this, you can use the disable command, which is documented in the man pages. The use of the r option is recommended to provide users with a short text explanation of the reason the printer is unavailable. An example is shown here:

 Athena:~ # disable -r "stuck label" Computer_Room_bj200 

To check the status of a printer, you can use the lpstat command. If you specify the t option, all the available status information for the print environment will be printed as well:

 Athena:~ # lpstat -t scheduler is running system default destination: Computer_Room_bj200 device for Computer_Room_bj200: parallel:/dev/lp0 Computer_Room_bj200 accepting requests since Jan 01 00:00 printer Computer_Room_bj200 disabled since Jan 01 00:00 -         stuck label printer Laserjet is idle.  enabled since Jan 01 00:00 Computer_Room_bj200-4   root 1024   Sun Feb 27 06:14:41 2005 Computer_Room_bj200-5   root 1024   Sun Feb 27 06:15:20 2005 Computer_Room_bj200-6   root 1024   Sun Feb 27 06:15:44 2005 Athena:~ # 

To allow printing to resume, you can use the enable command. You need to call the enable command using the fully qualified path to avoid shell confusion with the built-in enable command:

 Athena:~ # /usr/bin/enable Computer_Room_bj200 

When the preceding command is performed, printing on this device will resume.

NOTE

To avoid confusion between the different enable commands, it is suggested that an alias be created for the printer enable function. This can be done using the following syntax:

 Athena:~ # alias penable=/usr/bin/enable 

This allows you to use the synonym penable instead of having to specify the complete path to the enable command every time. Further, you can place it in your login shell to make this command available at all times. If you want to make this available to all, you can add the alias definition to /etc/bash.bashrc.


The CUPS Web Interface

We have seen that SLES offers both command-line tools and YaST for managing printers, queues, and jobs. Built into CUPS is the ability to manage the printing environment from a simple web browser. Through this web interface, all aspects of the printing environment can be addressed. Using a standard browser, CUPS can be accessed through http://localhost:631.

By default, the web interface provides read-only access to the classes, queues, and job information on a server. Before administrative tasks can be undertaken, a username/password pair must be created within the CUPS environment. Individuals who do not have any system management rights on the host can be readily made into CUPS administrators. You can do this by using the command-line verb lppasswd, as in the following example:

 Athena:/etc/cups # lppasswd -g sys -a hart Enter password: Enter password again: Athena:/etc/cups # 

In this example, a username/password pair was created for managing the CUPS environment. This allows the user named Hart to create new printers and classes and manage print jobs, but only from the local server node. This implies that Hart would need to have a local account and X Windows System access on the server. To extend the management capabilities of the CUPS web interface beyond the local machine, you must make a change to the /etc/cups/cupsd.conf configuration files.

The cupsd.conf file uses a syntax similar to that used for the configuration of the Apache2 server. Administrative access is based on the access controls defined for the /admin portion of the CUPS website. In cupsd.conf, the default configuration looks like this:

 <Location /admin> #   AuthType BasicDigest   AuthClass Group   AuthGroupName sys ## Restrict access to local domain   Order Deny,Allow   Deny From All   Allow From 127.0.0.1 #Encryption Required </Location> 

Additional access can be granted to individual workstations or subnets by inserting additional Allow From clauses. Ease of access must be balanced against exposure of the CUPS environment. To add a complete subnet, you can simply add the fourth octect set to a *, as follows:

 Allow From 192.168.1.* 

When a user accesses CUPS through the web interface, he or she will be presented with a browser window similar to that shown in Figure 9.7.

Figure 9.7. The main page of the CUPS web interface.


In Figure 9.7, the main menu breaks down the administration tasks into these main sections:

  • Administration, for authorized users

  • Classes

  • Jobs

  • Printers

  • Help

  • Software access the CUPS web site

The Administration menu option presents a window similar to that shown in Figure 9.8. You must choose this menu option if you need to define new printers or printer classes. The Add function is not found on the various other CUPS menus. Again, the administration page is available only to users who can authenticate using credentials established through the lppasswd command.

Figure 9.8. The Administration menu for the CUPS web interface.


The Class page is shown in Figure 9.9. As with subsequent administration pages, the Delete and Modify options are shown. Access to these selections requires appropriate authentication. Unauthorized users are simply presented with an authorization failure (an HTTP 403 error).

Figure 9.9. The CUPS Class page.


Figures 9.10 and 9.11 complete the series of menu options available under the CUPS web interface. Within the Jobs page, shown in Figure 9.10, you can see information on pending print jobs. Similarly, the Printer page, shown in Figure 9.11, presents configuration information on each printer, status information, as well as a number of management options.

Figure 9.11. The CUPS Printer management page.


The CUPS web interface into printer configuration management is an important step in easing the support of a distributed printing environment. The CUPS environment incorporates its own administration model. This permits the granting of administration rights to individuals outside the authentication scheme of the hosting server. Users who do not possess any privileges on the host server can therefore be granted administration rights directly within CUPS. This adds an additional layer of administrative burden when implementing an account management policy. It does, however, allow for the delegation of queue management to individuals such as helpdesk staff without the requirement of elevated user privileges on the server.



    SUSE LINUX Enterprise Server 9 Administrator's Handbook
    SUSE LINUX Enterprise Server 9 Administrators Handbook
    ISBN: 067232735X
    EAN: 2147483647
    Year: 2003
    Pages: 134

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