Administering PrintersObjective: 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. Note that the commands described in the following sections require superuser access. Deleting Printers and Managing Printer AccessYou 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.
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 ClassesYou 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:
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> The following example adds the printer luna to the class roughdrafts: lpadmin -p luna -c roughdrafts Checking Printer StatusYou 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 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 QueuesThe 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 JobTo 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 RequestYou 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.
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 PriorityThe 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 PrinterYou 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.
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:
Table 6.9 provides the valid values for user-list.
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 PrinterAs 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.
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 UserYou 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.
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 RequestYou 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.
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 SchedulerThe 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 PrinterWhen 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: $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 ManagerYou 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:
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 SchedulerThe 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. |