This chapter includes miscellaneous printing tasks that a system administrator might perform on a daily, weekly, or occasional basis by using LP print service commands.
For overview information, see Chapter 1, Introduction to Printing in the Oracle Solaris Operating System.
Task |
Description |
For Instructions |
---|---|---|
Check the status of printers. |
Use the lpstat command to check the status of all printers or a specific printer. This command allows you to determine which printers are available for use and enables you to examine the characteristics of those printers. | |
Stop the print scheduler. |
If the print scheduler stops accepting print requests, you might need to stop and restart the print scheduler. | |
Restart the print scheduler. |
After you stop the print scheduler, you will need to restart the print scheduler, so the printer can begin accepting requests. | |
Start the print scheduler with options. |
There are two ways to pass options to the print scheduler under the Solaris Management Facility (SMF). You can set options for the duration of a call, or you can set options to remain over a system boot. |
How to Set Print Option Values Only for the Duration of a Call How to Set Printer Option Values That Remain Over a System Reboot |
Many routine printer administration tasks require information about the status of the LP print service or a specific printer. For example, you can determine which printers are available for use. You can also examine the characteristics of those printers. You can use the lpstat command to find status information about the LP print service or a specific printer.
If a PPD file was used to create or modify a print queue, the specific PPD file is listed in the lpstat output. If a PPD file was not specified when the print queue was created, the PPD entry in the lpstat output is none.
Log in to any system on the network.
Check the status of printers.
Only the most commonly used options are shown here. For other options, see thelpstat(1) man page.
$ lpstat [-d] [-p] printer-name [-D] [-l] [-t] |
Shows the system's default printer.
Shows if a printer is active or idle, when the printer was enabled or disabled, and whether the printer is accepting print requests.
You can specify multiple printer names with this command. Use a space or a comma to separate printer names. If you use spaces, enclose the list of printer names in quotation marks. If you don't specify printer-name, the status of all printers is displayed.
Shows the description of the specified printer-name.
Shows the characteristics of the specified printer-name.
Shows status information about the LP print service, including the status of all printers, such as whether they are active and whether they are accepting print requests.
The following example shows how to display the system's default printer.
$ lpstat -d system default destination: luna |
The following example shows how to display the status of the printer luna.
$ lpstat -p luna printer luna is idle. enabled since Jul 12 11:17 2001. available. |
The following example shows how to display the description of the printers asteroid and luna.
$ lpstat -p "asteroid luna" -D printer asteroid faulted. enabled since Jan 5 11:35 2004. available. unable to print: paper misfeed jam Description: Printer by break room printer luna is idle. enabled since Jan 5 11:36 2004. available. Description: Printer by server room. |
The following example shows how to display the characteristics of the printer luna.
$ lpstat -p luna -l printer luna is idle. enabled since Thu Jul 12 15:02:32 PM PDT Form mounted: Content types: postscript Printer types: PS Description: Connection: direct Interface: /usr/lib/lp/model/standard PPD: none After fault: continue Users allowed: (all) Forms allowed: (none) Banner not required Character sets: (none) Default pitch: Default page size: 80 wide 66 long Default port settings: |
The print scheduler, lpsched, handles print requests on print servers. However, the print scheduler might sometimes stop running on a system, so print requests stop being accepted or printed. The lpadmin command automatically enables the lpsched service when local printers are added to the system and disables it when the last local printer is removed. The following procedures describe how to stop and restart the print scheduler. If a print request was printing when the print scheduler stopped running, the print request will be printed in its entirety when you restart the print scheduler.
Become superuser or assume an equivalent role.
Roles contain authorizations and privileged commands. For more information about roles, see Configuring RBAC (Task Map) in System Administration Guide: Security Services.
Determine if the print scheduler is running.
# svcs application/print/server |
You can also use the lpstat -r command to determine if the print scheduler is running.
If the print scheduler is not running, the message scheduler is not running is displayed.
If the print scheduler is running, stop it.
# svcadm disable application/print/server |
You can also use the lpshut command to stop the print scheduler.
Become superuser or assume an equivalent role.
Roles contain authorizations and privileged commands. For more information about roles, see Configuring RBAC (Task Map) in System Administration Guide: Security Services.
Determine if the print scheduler is running.
# svcs application/print/server |
You can also use the lpstat -r command to determine if the print scheduler is running.
If the print scheduler is not running, the message scheduler is not running is displayed.
If the print scheduler is not running, start it.
# svcadm enable application/print/server |
You can also use the /usr/lib/lpsched command to start the print scheduler. For more information about the difference between starting the print scheduler by using the /usr/lib/lpsched command or by using the svcadm enable application/print server command, see Starting the Print Scheduler With Options.
There are two ways to pass options to the print scheduler by using SMF:
By modifying option values only for the duration of a call.
Use the /usr/lib/lpsched command with the appropriate options when you only want to pass options to the print scheduler for the duration of a call. Before setting options, see the lpsched(1M) man page for more information about these default values and reasons for changing them.
By maintaining option values over a system reboot, or if the print scheduler is restarted.
The SMF manifest for the print server contains properties that are utilized by the print server start-up script. These property values are passed on to the print scheduler and represent the options, which are set by using the svccfg command.
The properties are as follows:
lpsched/num_filters
lpsched/num_notifiers
lpsched/fd_limit
lpsched/reserved_fds
Any options that are not set with the svccfg command will use the default values that are in the print scheduler. For more information about using the svccfg command, see the svccfg(1M) man page.
Become superuser or assume an equivalent role.
Roles contain authorizations and privileged commands. For more information about roles, see Configuring RBAC (Task Map) in System Administration Guide: Security Services.
Set option values.
# /usr/lib/lpsched option value |
Specifies the number of concurrent slow filters that can be run on a print server.
Specifies the number of concurrent notification processes that can run on a print server.
Specifies the file descriptor resource limit for the lpsched process.
Specifies the number of file descriptors that the scheduler reserves for internal communications under heavy load.
This example shows how to set the number of filters to 2. The remaining options will use the defaults that are in the print scheduler.
# /usr/lib/lpsched -f 2 |
To use the default options that are in the print scheduler, run the /usr/lib/lpsched command without any options.
Note that starting the print scheduler by using the /usr/lib/lpsched command does not utilize the values that are set with the svccfg command.
Become superuser, lp, or assume an equivalent role.
Roles contain authorizations and privileged commands. For more information about roles, see Configuring RBAC (Task Map) in System Administration Guide: Security Services.
Set one or all options.
# svccfg svc:> select svc:/application/print/server svc:/application/print/server> setprop property = value . . . svc:/application/print/server> quit |
For each option that you want to set, repeat the setprop property = value command on a separate line.
Verify that the option has been correctly set by displaying the current values of the print server properties.
# svcprop svc:/application/print/server |
Restart the print scheduler.
If the print scheduler is not running, use the following commands:
# svcadm refresh svc:/application/print/server # svcadm enable svc:/application/print/server |
If the print scheduler is running, use the following commands:
# svcadm refresh svc:/application/print/server # svcadm restart svc:/application/print/server |
To determine if the print scheduler is running, run the svcs application/print/server command.
This example shows how to set the number of filters to 1. This option will remain set over a system reboot, or if you restart the print scheduler.
# svccfg svc:> select svc:/application/print/server svc:/application/print/server> setprop lpsched/num_filters = count: 1 svc:/application/print/server> quit |
This example shows how to set all options.
# svccfg svc:> select svc:/application/print/server svc:/application/print/server> setprop lpsched/num_filters = count: 1 svc:/application/print/server> setprop lpsched/num_notifiers = count: 1 svc:/application/print/server> setprop lpsched/fd_limit = count: 4096 svc:/application/print/server> setprop lpsched/reserved_fds = count: 2 svc:/application/print/server> quit |
The following is a sample script that sets all options.
#!/bin/ksh svccfg <<-EOF select svc:/application/print/server setprop lpsched/num_filters = count: 1 setprop lpsched/num_notifiers = count: 1 setprop lpsched/fd_limit = count: 4096 setprop lpsched/reserved_fds = count: 2 EOF |
When a user submits a print request from a print client, the print request is added to a queue on the print server before it is sent to the printer. While a print request is in the queue, you can cancel or gain status information on the request from a client system. You must log in to the print server to move, hold, resume, or change the priorities of print requests with LP print service commands. These actions can help you keep printing services operating smoothly.
The following table lists the values for changing the priority of a print request by using the lp -H command.
Table 8–1 Values for Changing the Priority of a Print Request
Value for -H change-priority |
Description |
---|---|
hold |
Places the print request on hold until you cancel the request or instruct the LP print service to resume printing the request. |
resume |
Places a print request that has been on hold back in the queue. The request is printed according to its priority and placement in the queue. If you place on hold a print job that is already printing, resume places 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 the request on hold to allow the next request to print immediately. |
Become superuser or assume an equivalent role.
Roles contain authorizations and privileged commands. For more information about roles, see Configuring RBAC (Task Map) in System Administration Guide: Security Services.
Check the status of printers and print requests.
Only the most commonly used options are shown here. For other valid options, see the lpstat(1) man page.
$ lpstat -o [list] | -u [user-list] |
Shows the status of print requests on a specific printer. list can be one or more printer names, printer class names, or print request IDs.
To specify multiple printer names, class names, and IDs for list, use a space or a comma to separate values. If you use spaces, enclose the list of values in quotation marks.
If you don't specify list, the status of print requests sent to all printers is displayed.
Shows the status of print requests for a specific user. user-list can be one or more user names.
To specify multiple users with this command, use a space or a comma to separate user names. If you use spaces, enclose the list of names in quotation marks.
If you don't specify user-list, the status of print requests for all users is displayed.
When used to check the status of print requests, the lpstat command displays one line for each print request.
From left to right, the line shows the following information:
Request ID
User
Output size in bytes
Date and time of the request,
Information about the request, such as “being filtered.”
The following example shows that user fred has one print request queued on the printer luna.
$ lpstat luna-1 fred 1261 Jul 12 17:34 |
The following example shows that the user paul currently has no print requests in queue.
$ lpstat -u paul |
The following example shows that two print requests are queued on the printer moon.
$ lpstat -o moon moon-78 root 1024 Jul 14 09:07 moon-79 root 1024 Jul 14 09:08 |
The enable and disable commands control whether a printer prints or stops printing requests that are in the print queue. When you disable a printer, the printer stops printing requests in the queue. However, requests are still added to the queue. You must set the printer to reject print requests so that requests are not added to the queue. For information about rejecting print requests, see Accepting or Rejecting Print Requests.
A printer is enabled to print and accepts print requests when the printer is added by using Solaris Print Manager. Solaris Print Manager doesn't provide any additional printer processing management.
You must enable the printer whenever it has been disabled, which can happen when a printer fault occurs. When you enable a printer, it prints requests from the print queue until the queue is empty, even if the print service rejects additional requests for the print queue.
The following figure shows the point at which the processing of print requests is interrupted when a printer is disabled.
Become superuser or assume an equivalent role.
Roles contain authorizations and privileged commands. For more information about roles, see Configuring RBAC (Task Map) in System Administration Guide: Security Services.
# disable [-c | -W] [-r "reason"] printer-name |
Cancels the current job, then disables the printer. The current job is saved to reprint when the printer is enabled.
Cancels the current job, then disables the printer. The current job is not printed later.
Waits until the current job is finished before disabling the printer.
Provides users with a reason why the printer is disabled. The reason is stored and displayed whenever a user checks on the status of the printer by using the lpstat -p command.
Specifies the name of the printer that will stop printing print requests.
You cannot enable or disable classes of printers. Only individual printers can be enabled or disabled.
Start printing print requests.
# enable printer-name |
Verify that the printer is enabled.
# lpstat -p printer-name |
The following example shows how to stop the current job on the printer luna, save the job to print later, and provide a reason why the printer has stopped printing print requests.
# disable -r "changing the form" luna |
The following example shows how to start printing print requests on the printer luna.
# enable luna printer "luna" enabled |
The accept and reject commands enable you to turn on or turn off a print queue that stores requests to be printed.
When you use the reject command, the print queue for a specified printer is turned off. No new print requests can enter the queue on the print server. However, all print requests that are in the queue are still printed. You must disable the printer if you want it to stop printing requests that are already in the queue. The following table compares the functions of the accept, reject, enable, and disable commands.
Table 8–2 Functions of accept, reject, enable, and disable Print Commands
Command |
Function |
---|---|
accept |
Accepts print requests that are sent to the print queue. |
disable |
Stops printing requests that are currently in the print queue. |
enable |
Prints the requests that are in the print queue. |
reject |
Rejects print requests that are sent to the print queue. |
If a print request is rejected, the LP print service writes or mails a message to the user who submitted the request. the message states that print requests are not being accepted for the specified printer.
You can also specify a reason for not accepting requests through the command line. The reason is displayed on a user's system when a user tries to check the printer's queue. The following figure shows the point at which the processing of print requests is interrupted when a print queue rejects print requests.
Log in as superuser, lp, or assume an equivalent role on the print server.
Stop accepting print requests for the printer.
# reject [-r "reason"] printer-name |
Provides users with a reason why the printer is rejecting print requests. The reason is stored and displayed whenever a user checks on the status of the printer by using the lpstat -p command.
Specifies the name of the printer that will stop accepting print requests.
The queued requests continue printing as long as the printer is enabled. For instructions on disabling a printer so that it stops printing, see How to Enable or Disable a Printer.
Start accepting print requests for the printer.
# accept printer-name |
Check that the status of the printer to see whether it is accepting or rejecting print requests.
$ lpstat -p printer-name |
The following example shows how to stop the printer luna from accepting print requests.
# reject -r "luna is down for repairs" luna destination "luna" will no longer accept requests |
The following example shows how to set the printer luna to accept print requests.
# accept luna destination "luna" now accepting requests |
You can use the cancel command to cancel print requests in printer queues or to cancel jobs that are printing.
Three are three ways to use the cancel command:
Cancel requests by request identification number (request ID)
Cancel requests from a specific user on all printers or specific printers
Cancel the job currently printing
When you use the cancel command, a message tells you the request or requests are canceled, and the next request in queue is being printed.
You can cancel a print request only under the following conditions:
You are the user who submitted the request and you are logged in on the system from which you submitted the request.
You are the user who submitted the request on any client system and the print server has the “user-equivalence” option configured for the printer in its /etc/printers.conf file.
You are logged in as superuser, lp, or have assumed an equivalent role on the print server.
To cancel a specific request, you need to know its request ID. The request ID contains the name of the printer, a dash, and the number of the print request. For example, luna-185.
When you submit the print request, the request ID is displayed. If you do not remember the print request ID, you can find it by using the lpstat command with the -o printer option.
If you are going to cancel the print requests of other users, then become superuser, lp, or assume an equivalent role.
Determine the request IDs of the print requests to cancel.
# lpstat |
For more details, see How to Check the Status of Print Requests.
Cancel the print request.
# cancel request-id | printer-name |
Specifies the request ID of a print request to be canceled. You can specify multiple request IDs with this command. Use a space or a comma to separate request IDs. If you use spaces, enclose the list of request IDs in quotation marks.
Specifies the printer for which you want to cancel the currently printing print request.
You can specify multiple printer names with this command. Use a space or a comma to separate printer names. If you use spaces, enclose the list of printer names in quotation marks.
Verify that the print requests are canceled.
$ lpstat -o printer-name |
The following example shows how to cancel the luna-3 and luna-4 print requests.
$ cancel luna-3 luna-4 request "luna-3" cancelled request "luna-4" cancelled |
The following example shows how to cancel the print request that is currently printing on the printer luna.
# cancel luna request "luna-9" cancelled |
If you are going to cancel the print requests of other users,become superuser, lp, or assume an equivalent role.
Cancel a print request from a specific user.
$ cancel -u user-list [printer-name] |
Cancels the print request for a specified user.
user-list can be one or more user names. Use a space or a comma to separate user names. If you use spaces, enclose the list of names in double quotation marks.
Specifies the printer for which you want to cancel the print requests for a specified user.
printer-name can be one or more printer names. Use a space or a comma to separate printer names. If you use spaces, enclose the list of printer names in quotation marks.
If you don't specify the printer-name, the print requests for the specified user is canceled on all printers.
The following example shows how to cancel all the print requests submitted by the user george on the printer luna.
# cancel -u george luna request "luna-23" cancelled |
The following example shows how to cancel all the print requests submitted by the user george on all printers.
# cancel -u george request "asteroid-3" cancelled request "luna-8" cancelled |
If you plan to change the way a printer is used or decide to take a printer out of service, you should set up the LP print service to reject additional print requests. Then, move or cancel any requests that are currently queued to the printer. You can use the lpmove command to move individual or all print requests to another local printer.
Request IDs are not changed when you move print requests, so users can still find their requests. Print requests that have requirements, such as a specific file content type or form, that cannot be met by the newly specified printer cannot be moved. These print requests must be canceled.
To move all print requests from one printer to another printer, you do not need to know the request IDs. However, first determine how many print requests are affected before you move them.
Become superuser or assume an equivalent role.
Roles contain authorizations and privileged commands. For more information about roles, see Configuring RBAC (Task Map) in System Administration Guide: Security Services.
List the IDs of the print requests on the original printer.
# lpstat -o printer-name1 |
Check to see if the destination printer is accepting print requests.
# lpstat -a printer-name2 |
-a printer-name2 reports whether print destinations are accepting requests.
Move all the print requests from the original printer to the destination printer.
# lpmove printer-name1 printer-name2 |
Specifies the name of the printer from which all print requests will be moved.
Specifies the name of the printer to which all print requests will be moved.
For more information, see the lpmove(1M) man page.
If some requests cannot be printed on the destination printer, the requests are left in the original printer's queue. By using request IDs, you can also move specific print requests to another printer by using the lpmove command.
Start accepting print requests on the original printer.
If you move all the print requests to another printer, the lpmove command automatically stops accepting print requests for the printer. This step is necessary if you want to begin accepting new print requests for the printer.
# accept printer-name1 |
Check for any remaining print requests in the original printer's queue.
# lpstat -o printer-name1 |
Ensure that all specified print requests were moved to the destination printer's queue.
# lpstat -o printer-name2 |
The following example shows how to move print requests from the printer luna to the printer terra. Then, the original printer, luna, is instructed to resume accepting print requests.
# lpmove luna terra # accept luna |
After a user has submitted a print request, you can change its priority in the print server's queue by doing any of the following:
Putting any print request on hold if it has not finished printing. Putting a request on hold stops the request, if it is currently printing, and keeps it from printing until you resume printing it. Other print requests go ahead of the on-hold request.
Moving any print request to the head of the queue, where it will become the next job eligible for printing. If you want a job to start printing immediately, you can interrupt the job that is currently printing by putting it on hold.
Changing the priority of a job still waiting to be printed or moving the job in the queue. Doing so will move the job ahead of lower priority requests and behind other requests that are the same priority or higher priority.
Become superuser or assume an equivalent role.
Roles contain authorizations and privileged commands. For more information about roles, see Configuring RBAC (Task Map) in System Administration Guide: Security Services.
Determine the request IDs of the print requests whose priority you want to change.
# lpstat |
For more information, see How to Check the Status of Print Requests.
Change the priority of a print request.
# lp -i request-id -H change-priority |
Specifies the request ID of a print request you want to change.
You can specify multiple request IDs with this command. Use a space or a comma to separate request IDs. If you use spaces, enclose the list of request IDs in quotation marks.
Specifies one of the three ways to change the priority of a print request: hold, resume, immediate.
For detailed information about valid values for change-priority, see Table 8–1.
You can also use the lp -q command to change the priority level of a specified print request. You can change the priority level from 0, the highest priority, to 39, the lowest priority.
The following example shows how to change a print request with the request ID asteroid-79, to priority level 1.
# lp -i asteroid-79 -q 1 |