Managing the print system involves monitoring the lp system and uncovering reasons why it might not be working properly. Other routine tasks involve canceling print jobs and enabling or disabling a printer while it’s being serviced. This section provides instructions for the daily tasks you will perform to manage printers and the print scheduler. All of the following commands require superuser access.
Use Admintool to delete a printer from the system. In the Print Manager window of Admintool, highlight the printer you want to delete and select Edit, Delete, as shown in Figure 24.11. The printer queue will be deleted from the system.
To delete a printer at the command line, 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. 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.
Perhaps a printer will be going offline for repairs. To stop accepting print requests on a particular printer, type the following command on the system where the printer is physically connected:
reject <printer-name>
This step prevents any new requests from entering the printer’s queue while you are in the process of removing the printer.
To allow a printer to keep taking requests but to stop the printer from printing the requests, type the following command on the system where the printer is physically connected:
disable <printer-name>
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, use the lpmove command as follows:
lpmove <printer1> < printer2>
The arguments for the lpmove command are described in Table 24.4.
If you move all the print requests to another printer, the lpmove command automatically stops accepting print requests for printer1. This next step 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). After the printer is ready to start accepting print jobs again, use the accept command to resume accepting print requests on eps1:
lpmove eps1 eps2 accept eps1
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. When you have set up a printer class, users can then specify the class (rather than an individual printer) 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 with the lpadmin command, as follows:
lpadmin –c
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 work group 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 add 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 reserved 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 obligated to define printer classes. You should add them only if you determine that using printer classes would benefit the users on the network.
Exercise 24.3 Defining Printer Classes
To define a printer class, follow these steps:
1. |
Log in as superuser or lp on the print server. |
2. |
Define a class of printers by using the lpadmin command: lpadmin -p <printer-name> -c <printer-class> |
The arguments used to define printer classes using lpadmin are described in Table 24.5.
Argument | Description |
---|---|
-p <printer-name> | The name of the printer you are adding to a class of printers |
-c <printer-class> | The name of a class of printers |
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.Verify the printers in a printer class by using the lpstat command:
lpstat -c <printer-class>
In the following example, the command adds the printer luna to the class roughdrafts:
lpadmin -p luna -c roughdrafts
The lpstat command is used 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 24.6.
The following are a few examples of the lpstat command:
lpstat -p hplaser
The system responds with this:
printer hplaser is idle. enabled since Jun 16 10:09 2002. available.
In the following example, the command requests a description of the printers hplaser1 and hplaser2:
lpstat -p "hplaser1 hplaser2" -D printer hplaser1 faulted. enabled since Jun 16 10:09 2002. available. unable to print: paper misfeed jam Description: Printer by finance. printer hplaser2 is idle. enabled since Jun 16 10:09 2002. available. Description: Printer in computer room.
In the following example, the command requests the characteristics of the printer hplaser:
lpstat -p hplaser -l printer hplaser is idle. enabled since Jun 16 10:11 2002. available. Content types: any Printer types: unknown Description: Printer by computer room. Users allowed: (all) Forms allowed: (none) Banner not required Character sets: (none) Default is pitch: Default page size:
Part of the routine task of managing printers is 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 outlines some of the routine tasks you might want to perform on the printer queues.
To remove someone else’s print job from the print queue, you first need to become root. Then determine the request ID of the print request to cancel by using the lpstat command as follows:
lpstat -u bcalkins
The system displays:
eps1-1 bcalkins 1261 Mar 16 17:34
In this example, user bcalkins has one request in the queue. The request ID is eps1-1.
Cancel a print request by using the cancel command. The command syntax is as follows:
cancel <request-ID> | <printer-name>
The arguments for the cancel command are described in Table 24.7.
In the following example, the command cancels the eps1-3 and eps1-4 print requests:
cancel eps1-3 eps1-4
The system responds with:
request "eps1-3" cancelled request "eps1-4" cancelled
In the next example, the command cancels the print request that is currently printing on the printer eps1:
cancel eps1
request "eps1-9" cancelled
The lp command with the -q option assigns the print request a priority in the print queue. Specify the priority level as an integer from 0 to 39. Use 0 to indicate the highest priority and 39 to indicate the lowest. If no priority is specified, the LP administrator assigns the default priority for a print service.
The following example illustrates how to send a print job to printer eps1 with the highest priority:
lp -deps1 -q0 file1
You can allow or deny users access to a printer by using the lpadmin command.
The arguments for the lpadmin command that are used to control access to a printer are described in Table 24.8.
Argument | Description |
---|---|
-p <printer-name> | The name of the printer to which the allow or deny user access list applies. |
-u allow:<user-list> | Usernames to be added to the allow user access list. You can specify multiple usernames with this command. Use a space or a comma to separate names. If you use spaces, enclose the list of names in quotes. Table 24.9 provides the valid values for user-list . |
-u deny:<user-list> | Usernames to be added to the deny user access list. You can specify multiple usernames with this command. Use a space or a comma to separate names. If you use spaces, enclose the list of names in quotes. Table 24.9 provides the valid values for user-list . |
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
Note
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
In the following example, the command gives only the users bcalkins and bholzgen access to the printer eps1:
lpadmin -p eps1 -u allow:bcalkins,bholzgen
In the next example, the command denies the users bcalkins and bholzgen access to the printer eps2:
lpadmin -p eps2 -u deny:"bcalkins bholzgen"
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:
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 24.10.
The following example stops the printer eps1 from accepting print requests:
reject -r "eps1 is down for repairs" eps1
The system responds with:
destination "eps1" will no longer accept requests
Any queued requests will continue printing as long as the printer is enabled. In the following example, the command sets the printer eps1 to accept print requests again:
accept eps1
destination "eps1" now accepting requests
Change to the root or lp user if you want to cancel print requests of other users. 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 24.11.
In the following example, the command cancels all the print requests submitted by the user bcalkins on the printer luna:
cancel -u bcalkins luna
The system responds with:
request "luna-23" cancelled
In the following example, the command cancels all the print requests submitted by the user bcalkins on all printers:
cancel -u bcalkins
request "asteroid-3" cancelled request "luna-8" cancelled
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 24.12.
In the following exampl e, the command changes a print request with the request ID eps1-29 to priority level 1:
lp -i eps1-29 -q 1
The print scheduler, lpsched, handles 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 lpsched command. If a print request was printing when the print scheduler stopped running, that request will be printed in its entirety when you restart the print scheduler. First stop the scheduler by typing the following:
/usr/lib/lp/lpshut
To restart the scheduler, type the following:
/usr/lib/lp/lpsched
The LP system is started by the /etc/init.d script named LP. There is a link from this file to the /etc/rc2.d directory so that the LP service starts automatically every time the system is booted. The same script can be used to reset the entire LP service by issuing the following command:
/etc/init.d/lp stop
The LP service will be stopped. You can restart the LP service with the following command:
/etc/init.d/lp start
Note
The /etc/init.d/lp script starts and stops the entire print service and not just the scheduler. Use lpshut and lpsched to stop and restart the scheduler only.
When you added the printer, you were 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 printer. If users don’t provide a printer name when sending a print job, the print command searches for the default printer in the following order:
LPDEST variable
PRINTER variable
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 variable named _default is checked for in the following files:
$HOME/.printers
An entry in this file naming 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, the name service database is checked if you’re running a name service, as described in Chapter 23, “Name Services.” If the destination printer name cannot be located in any of these files, the print request cannot be processed.
Solaris Admintool can be used to modify a printer after it has been added to the system. Modifications that can be made to a printer via Admintool include the following:
Giving the printer description
Indicating the printer port
Listing file contents
Providing fault notification
Selecting a default printer
Printing a banner
Accepting and processing print requests
Providing a user access list
To modify a printer via Admintool, select Edit, Modify from the Printers window, as was shown in Figure 24.11.
The Modify Printer window appears, as shown in Figure 24.12.
Modify the selected printer by selecting or filling in the appropriate fields in the Modify Printer window.