Previous Page
Next Page

Administering Printers

Objective:

Explain how to configure printer classes, set the default printer, change the default printer class, remove a printer's configuration, start the LP print service, and stop the LP print service using the appropriate commands.

  • Given a scenario, identify the appropriate commands to specify a destination printer, accept and reject print jobs, enable and disable printers, and move print jobs.

Managing the print system involves monitoring the lp system and uncovering reasons it might not be working properly. Other routine tasks involve cancelling print jobs and enabling or disabling a printer while it's being serviced. The following sections provide instructions for the daily tasks you will perform to manage printers and the print scheduler.

Note that the commands described in the following sections require superuser access.

Deleting Printers and Managing Printer Access

You can use Print Manager to delete a printer from the system. To do so, in the Print Manager main window, highlight the printer that you want to delete and, from the top toolbar, select Printer. From the pull-down menu, select Delete Printer, as shown in Figure 6.6. The printer queue is deleted from the system.

Figure 6.6. Deleting a printer.


To delete a printer from the command line, you issue the following command on the system where the printer is connected:

lpadmin -x <printer-name>

The printer is deleted from the system.

Perhaps you do not want to remove the printer from the print server, but you want to keep a particular system from printing to the print server. In this case, you issue the following command on the print client from which you want to delete the printer:

lpsystem -r <print-server>

The print server is deleted from the print client's /etc/lp/Systems file.

To stop accepting print requests on a particular printerperhaps because a printer will be going offline for repairsyou type the following command on the system where the printer is physically connected:

reject <printer-name>

This command prevents any new requests from entering the printer's queue while you are in the process of removing the printer. Use the accept command, described later in this section, to allow the queue to start accepting requests.

To allow a printer to keep taking requests but to stop the printer from printing the requests, you issue the following command on the system where the printer is physically connected:

disable <printer-name>

Printing will be halted on this system until you issue the following command:

enable <printer-name>

Note

Using enable in the bash Shell If you are using the bash shell, be aware that enable is a built-in shell command that conflicts with the LP system's enable command. When using bash, you must give the full path to enable, /usr/bin/enable.


When stopping or disabling a printer, you might need to move existing jobs that have been queued to that printer. To move print jobs from one printer to another, you use the lpmove command, as follows:

lpmove <printer1> <printer2>

The arguments for the lpmove command are described in Table 6.4.

Table 6.4. lpmove Arguments

Argument

Description

< printer1 >

The name of the printer from which all print requests will be moved

< printer2 >

The name of the printer to which all print requests will be moved


If you move all the print requests to another printer, the lpmove command automatically stops accepting print requests for printer1. The following command is necessary if you want to begin accepting new print requests for the printer:

accept printer1

In the following example, the lpmove command moves print requests from the printer eps1 to the printer eps2 (for example, when eps1 is being taken down for maintenance). When the eps1 printer is ready to start accepting print jobs again, you use the accept command to resume accepting print requests on eps1:

lpmove eps1 eps2
accept eps1

Creating Printer Classes

You can put several locally attached printers into a group called a printer class. This might be helpful if you have several printers sitting next to each other and it doesn't matter which printer your job goes to. After you have set up a printer class, users can specify the class (rather than individual printers) as the destination for a print request. The first printer in the class that is free to print is used. The result is faster turnaround because all printers are utilized. You create printer classes by issuing the lpadmin command with the -c option, as follows:

lpadmin -p <printer name> -c <class name>

No default printer classes are known to the print service; printer classes exist only if you define them. The following are three ways you can define printer classes:

  • By printer type (for example, PostScript)

  • By location (for example, 5th floor)

  • By workgroup or department (for example, Accounting)

Alternatively, a class might contain several printers that are used in a particular order. The LP print service always checks for an available printer in the order in which printers were added to a class. Therefore, if you want a high-speed printer to be accessed first, you would add it to the class before you added a low-speed printer. As a result, the high-speed printer would handle as many print requests as possible. The low-speed printer would be used as a backup printer for when the high-speed printer was in use.

Printer class names must be unique and can contain a maximum of 14 alphanumeric characters and underscores. You are not obliged to define printer classes. You should add them only if you determine that using printer classes would benefit the users on the network.

Step by Step 6.3 describes how to define a printer class.

Step By Step 6.3: Defining Printer Classes

1.
Log in as superuser or issue the lp command on the print server.

2.
Define a class of printers by using the lpadmin command:

lpadmin -p <printer-name> -c <printer-class>


The arguments that are used with lpadmin to define printer classes are described in Table 6.5.

Table 6.5. lpadmin Arguments

Argument

Description

-p <printer-name>

This option allows you to specify the name of the printer you are adding to a class of printers.

-c <printer-class>

This option allows you to specify the printer class name.


The specified printer is added to the end of the class's list in the print server's /etc/lp/classes/<printer-class> file. If the printer class does not exist, it is created. You can verify what printers are in a printer class by using the lpstat command:

lpstat -c <printer-class>

The following example adds the printer luna to the class roughdrafts:

lpadmin -p luna -c roughdrafts

Checking Printer Status

You use the lpstat command to verify the status of a printer. You can use this command to determine which printers are available for use or to examine the characteristics of a particular printer. The lpstat command syntax is as follows:

lpstat [-a] [-d] [-p <printer-name> [-D] [-l]] [-t] [-u <logon_IDs>]

The lpstat command options are described in Table 6.6.

Table 6.6. lpstat Command Syntax and Options

Option

Description

-a

Reports whether printers are accepting requests. You can also specify a specific list of printers, as in lpstat -a eps1 eps2 eps3.

-d

Shows the system's default printer.

-p <printer-name>

Shows whether a printer is active or idle, when it was enabled or disabled, and whether it is accepting print requests. You can specify multiple printer names with this command. You use spaces or commas to separate printer names. If you use spaces, you need to enclose the list of printer names in quotes. If you don't specify the printer name, the status of all printers is displayed.

-D

Shows the description of the specified printer.

-l

Shows the characteristics of the specified printer.

-t

Shows status information about the LP print service, including the status of all printerswhether they are active and whether they are accepting print requests.

-u <logon-IDs>

Prints the status of output requests for users, in which <logon-IDs> can be one or all of the following:

 

<user> A user on the local system, as in lpstat -u bcalkins.

 

<host!user> A user on a system, as in lpstat -u systema!bcalkins.

 

<host!all> All users on a particular system, as in lpstat- u systema!all.

 

<all!user> A particular user on all systems, as in lpstat -u all!bcalkins.

 

all All users on all systems specified, as in lpstat -u all.


The following is an example of the lpstat command:

lpstat -p hplaser

The system responds with this:

printer hplaser is idle. enabled since Jun 16 10:09 2005.
available.

The following example requests a description of the printers hplaser1 and hplaser2:

lpstat -p "hplaser1 hplaser2" -D
printer hplaser1 faulted. enabled since Jun 16 10:09 2005.
available.
unable to print: paper misfeed jam

Description: Printer by finance.
printer hplaser2 is idle. enabled since Jun 16 10:09 2005.
available.
Description: Printer in computer room.

The following example requests the characteristics of the printer hplaser:

lpstat -p hplaser -l
printer hplaser disabled since Tue Aug 30 20:25:34 2005. available.
        new printer
        Form mounted:
        Content types: simple
        Printer types: unknown
        Description:
        Connection: direct
        Interface: /usr/lib/lp/model/standard
        PPD: none
        On fault: write to root once
        After fault: continue
        Users allowed:
                (all)
        Forms allowed:
                (none)
        Banner required
        Character sets:
                (none)
        Default pitch:
        Default page size:
        Default port settings:

Managing Printer Queues

The routine task of managing printers involves managing their queues. Occasionally, large jobs are submitted that are not needed and can be aborted. Other times you might want to put a high-priority job ahead of other jobs that are waiting to be printed. The following sections outline some of the routine tasks you might want to perform on the printer queues.

Viewing a Print Job

To remove someone else's print job from the print queue, you first need to become root. Then you need to determine the request ID of the print request to cancel, by using the lpstat command as follows:

lpstat -u bcalkins

The system displays this:

eps1-1    bcalkins     1261    Mar 16 17:34

In this example, the user bcalkins has one request in the queue. The request ID is eps1-1.

Cancelling a Print Request

You can cancel a print request by using the cancel command, which has the following syntax:

cancel <request-ID> | <printer-name>

The arguments for the cancel command are described in Table 6.7.

Table 6.7. cancel Arguments

Argument

Description

<request-ID>

The request ID of a print request to be cancelled. You can specify multiple request IDs. You use spaces or commas to separate request IDs. If you use spaces, you need to enclose the list of request IDs in quotes.

<printer-name>

Specifies the printer for which you want to cancel the currently printing print request. You can specify multiple printer names with this command. You can use spaces or commas to separate printer names.


The following example cancels the eps1-3 and eps1-4 print requests:

cancel eps1-3 eps1-4

The system responds with this:

request "eps1-3" cancelled
request "eps1-4" cancelled

The following example cancels the print request that is currently printing on the printer eps1:

cancel eps1

The system responds with this:

request "eps1-9" cancelled

Sending a Print Job at a Higher Priority

The lp command with the -q option assigns the print request a priority in the print queue. You specify the priority level as an integer from 0 to 39. You use 0 to indicate the highest priority and 39 to indicate the lowest. If no priority is specified, the system administrator assigns the default priority for a print service.

The following example illustrates how to send a print job to the printer eps1, with the highest priority:

lp -d eps1 -q 0 file1

Limiting User Access to a Printer

You can allow or deny users access to a printer by using the lpadmin command and adding usernames to an access list. The access list can be a list of specific users who are denied access (deny access list) or a list of users who are allowed access (allow access list). By default, all users are allowed access to a printer. This is the syntax for modifying access lists by using the lpadmin command:

lpadmin -p <printername> -u <lpadmin-argument>

The arguments for the lpadmin command that are used to control access to a printer are described in Table 6.8.

Table 6.8. lpadmin Arguments

Argument

Description

-p <printer-name>

This option allows you to specify the name of the printer to which the allow or deny user access list applies.

-u allow:<user-list>

This option allows you to specify the usernames to be added to the allow user access list. You can specify multiple usernames with this command. You use spaces or commas to separate names. If you use spaces, you need to enclose the list of names in quotes. Table 6.9 describes the valid values for user-list.

-u deny:<user-list>

This option allows you to specify the usernames to be added to the deny user access list. You can specify multiple usernames with this command. You use spaces or commas to separate names. If you use spaces, you need to enclose the list of names in quotes.


The specified users are added to the allow or deny user access list for the printer in one of the following files on the print server:

  • /etc/lp/printers/<printer-name>/users.allow

  • /etc/lp/printers/<printer-name>/users.deny

Table 6.9 provides the valid values for user-list.

Table 6.9. Values for Allow and Deny User Access Lists

Value for user-list

Description

user

A user on any system

all

All users on all systems

none

No user on any system

system!user

A user on the specified system only

!user

A user on the local system only

all!user

A user on any system

all!all

All users on all systems

system!all

All users on the specified system

!all

All users on the local system


Note

Specifying none in user-list If you specify none as the value for user-list in the allow user access list, the following files are not created for the print server:

/etc/lp/printers/<printer-name>/alert.sh
/etc/lp/printers/<printer-name>/alert.var
/etc/lp/printers/<printer-name>/users.allow
/etc/lp/printers/<printer-name>/users.deny


The following example gives only the users bcalkins and bholzgen access to the printer eps1:

lpadmin -p eps1 -u allow:bcalkins,bholzgen

The following example denies the users bcalkins and bholzgen access to the printer eps2:

lpadmin -p eps2 -u deny:"bcalkins bholzgen"

You can use the lpstat command to view access information about a particular printer. The following command displays access information for the printer named eps1:

lpstat -p eps1 -l

The system responds with this:

printer eps1 is idle. enabled since Mon Mar 20 14:39:48 EST 2002.
available.


        Form mounted:
        Content types: postscript
        Printer types: PS
        Description: epson
        Connection: direct
        Interface: /usr/lib/lp/model/standard
        On fault: write to root once
        After fault: continue
        Users allowed:
        bcalkins
        bholzgen
        Forms allowed:
               (none)
        Banner not required
        Character sets:


        Default pitch:
        Default page size: 80 wide 66 long
        Default port settings:

Accepting or Rejecting Print Requests for a Printer

As root, you can stop accepting print requests for the printer by using the reject command. The command syntax is as follows:

reject [-r "reason"] <printer-name>

The arguments for the reject command are described in Table 6.10.

Table 6.10. reject Arguments

Argument

Description

-r "reason"

Tells the users why the printer is rejecting print requests. reason is stored and displayed whenever a user checks on the status of the printer by using lpstat -p.

<printer-name>

Specifies the name of the printer that will stop accepting print requests.


The following example stops the printer eps1 from accepting print requests:

reject -r "eps1 is down for repairs" eps1

The system responds with this:

destination "eps1" will no longer accept requests

Any queued requests will continue printing as long as the printer is enabled. The following example sets the printer eps1 to accept print requests again:

accept eps1

The system responds with this:

destination "eps1" now accepting requests

Cancelling a Print Request from a Specific User

You need to be the root or lp user if you want to cancel print requests of other users. You cancel a print request from a specific user with the cancel command. The syntax is as follows:

cancel -u <user-list> <printer-name>

The arguments for the cancel command are described in Table 6.11.

Table 6.11. cancel Arguments

Argument

Description

-u <user-list>

Cancels the print request for a specified user(s). user-list can be one or more usernames. You use spaces or commas to separate usernames. If you use spaces, you need to enclose the list of names in quotes.

<printer-name>

Specifies the printer(s) for which you want to cancel the specified user's print requests. You use spaces or commas to separate printer names. If you use spaces, you need to enclose the list of printer names in quotes. If you don't specify printer-name, the user's print requests will be cancelled on all printers.


The following example cancels all the print requests submitted by the user bcalkins on the printer luna:

cancel -u bcalkins luna

The system responds with this:

request "luna-23" cancelled

The following example cancels all the print requests submitted by the user bcalkins on all printers:

cancel -u bcalkins

The system responds with this:

request "asteroid-3" cancelled
request "luna-8" cancelled

Changing the Priority of a Print Request

You can change the priority of a print request by using the following lp command:

lp -i <request-id> -H <change-priority> -q <priority-level>

The options for the lp command are described in Table 6.12.

Table 6.12. lp Options

Option

Description

-i <request-id>

Specifies the request ID(s) of a print request that you want to change. You use a space or a comma to separate request IDs. If you use spaces, you need to enclose the list of request IDs in quotation marks.

-H <change-priority>

Specifies one of the three ways to change the priority of a print request:

 

hold Places the print request on hold until you cancel it or instruct the LP print service to resume printing the request.

 

resume Places a print request that has been on hold in the queue. It will be printed according to its priority and placement in the queue. If you put a hold on a print job that is already printing, resume puts the print request at the head of the queue so that it becomes the next request printed.

 

immediate Places a print request at the head of the queue. If a request is already printing, you can put that request on hold to allow the next request to print immediately.

-q <priority-level>

Assigns the print request a priority in the print queue. You specify priority-level as an integer from 0 to 39. 0 indicates the highest priority, and 39 indicates the lowest priority.


In the following example, the command changes a print request with the request ID eps1-29 to priority level 1:

lp -i eps1-29 -q 1

Restarting the Print Scheduler

The Solaris print scheduler, lpsched, schedules all print requests on print servers. If printouts are not coming out of the printer, you might need to restart the print scheduler. To restart the print scheduler, you use the svcadm restart scv:/application/print/server:default command. If a print request was printing when the print scheduler stopped running, that request would be printed in its entirety when you restart the print scheduler. You first stop the scheduler by typing the following:

svcadm disable -t scv:/application/print/server:default

To restart the scheduler, you type the following:

svcadm enable -t scv:/application/print/server:default

Setting a User's Default Printer

When you add a printer, you are given the option of selecting that printer as the default printer for that particular system. You might want to set the default printer at the user level so that, on a particular system, users can specify their own default printers. If a user doesn't provide a printer name when sending a print job, the print command searches for the default printer in the following order:

  1. LPDEST variable

  2. PRINTER variable

  3. System's default printer

These variables can be set in the user's .profile file. The lp command checks LPDEST and then PRINTER. If neither variable has been set, the print command searches for the variable named _default in the following file:

$HOME/.printers

An entry in this file that names printer1 as the default printer looks like this:

default printer1

If the $HOME/.printers file does not exist, the /etc/printers.conf file is checked. An entry in this file would look like this:

_default|lp:
       :use=system1:
       :bsdaddr=system1,printer1

If the _default variable is not set in the /etc/printers.conf file and if you're running a name service, the name service database is checked as described in Chapter 12, "Naming Services." If the destination printer name cannot be located in any of these files, the print request cannot be processed.

Modifying the Printer with Print Manager

You can use Solaris Print Manager to modify a printer after it has been added to the system. Modifications that can be made to a printer via Print Manager include the following:

  • Giving the printer description

  • Indicating the printer port

  • Listing file contents

  • Providing fault notification

  • Selecting a default printer

  • Printing a banner page

  • Accepting and processing print requests

  • Providing a user access list

To modify a printer via the Print Manager GUI, you select Printers from the top toolbar, and then you select Modify Printer Properties, as shown in Figure 6.7.

Figure 6.7. Modifying printers.


The Modify Printer Properties window appears, as shown in Figure 6.8.

Figure 6.8. The Modify Printer Properties window.


You can modify the selected printer by selecting or filling in the appropriate fields in the Modify Printer Properties window.

Troubleshooting the Print Scheduler

The lpsched daemon keeps a log file of each print request that it processes and notes any errors that occur during the printing process. This log file is kept in the /var/lp/logs/lpsched file. By default, every Sunday at 3:13 a.m., the lp cron job renames the /var/lp/logs/lpsched file to a new lpsched.n file 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 the lpsched daemon has done with a printing job.


Previous Page
Next Page