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.
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.
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.
lpadmin -x <printer-name>
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>
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:
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.
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.
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:
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>
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.
The arguments that are used with lpadmin to define printer classes are described in Table 6.5.
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>
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.
The following is an example of the lpstat command:
lpstat -p hplaser
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.
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
Cancelling a Print Request
cancel <request-ID> | <printer-name>
The arguments for the cancel command are described in Table 6.7.
cancel eps1-3 eps1-4
The system responds with this:
request "eps1-3" cancelled request "eps1-4" cancelled
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.
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.9 provides the valid values for user-list.
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
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"
lpstat -p eps1 -l
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
reject [-r "reason"] <printer-name>
The arguments for the reject command are described in Table 6.10.
reject -r "eps1 is down for repairs" eps1
destination "eps1" will no longer accept requests
destination "eps1" now accepting requests
Cancelling a Print Request from a Specific User
cancel -u <user-list> <printer-name>
The arguments for the cancel command are described in Table 6.11.
cancel -u bcalkins luna
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
lp -i <request-id> -H <change-priority> -q <priority-level>
The options for the lp command are described in Table 6.12.
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:
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:
An entry in this file that names printer1 as the default printer looks like this:
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
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.
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.