|Previous||Table of Contents||Next|
The external lpstat command returns status about the lp printer subsystem. To learn more about sending output to a printer refer to Module 79. To cancel output sent to a printer refer to Module 12. You can use lpstat to display information or status as follows:
Whether a printer accepts requests or is disabled
Following is the general format of the lpstat command.
lpstat [ -drRst ] [ -a[list] ] [ -c[list] ] [ -f[list] [ -l ] \ [ -o[list] ] [ -p[list] [ -D ] [ -l ] ] [ -S[list] [ -l ] ] [ -u[list] ] [ -v[list] ]
The \ informs you to continue the line; no new-line is interpreted.
The following list describes the options and their arguments that may be used to control how lpstat functions.
|-d||Displays the system default destination printer.|
|-r||Displays the status of the lp scheduler daemon, lpsched.|
|-R||Displays the position of the job in the print queue.|
|-s||Displays a status summary: the system default destination printer, printer classes and their members, lpsched status, and a list of printers and their related devices. Same as using the -c -d -r -v options.|
|-t||Displays all (total) status information. Although the information appears somewhat cluttered, it is in a standard format.|
|* The first line informs you whether or not the spooling scheduler daemon is running.|
|* The second line states the default printer.|
|* The next set of lines maps the printer name to its hardware device name.|
|* The next set informs you whether or not a printer is accepting print requests.|
|* The next set displays the current state of the printer queue. The lj-419 request is printing on the lj printer, while the dp printer is idle.|
|* The last set of information is the print queue.|
|-a[list]||Displays the acceptance status of printers in the list. If a printer is accepting requests, it is enabled and ready to print. If a printer is not accepting jobs, it is disabled and not ready to print. The administrative commands enable and disable are used to change this state. The list may contain printers and classes of printers. If no list is given, all printers in all classes are displayed.|
|-c[list]||Displays each printer class name and all printers that are members of each class. The list consists of class names. If no list is given, all printers in all classes are displayed.|
|-f[list] [-D] [-l]||Verifies (by displaying) the list of forms exists. If list is not specified, the default is all. The -l option forces long descriptions for each form in the list.|
|-o[list]||Displays the status of output printer requests. List contains class names, printer names, and request IDs. If no list is given, all requests for printers in all classes are displayed.|
|-p[list] [-D] [-l]||Displays the status of each printer. List contains printer names. If no list is given, all printers are displayed.|
|-S[list] [-l]||Verifies (by displaying) the list of character sets and print wheels specified in list are supported by the lp print service. The default for list is all. If the -l option is specified, a list of printers that can support the character set or print wheel follows each line.|
|-u[list]||Displays the status for each user given in list. List contains login (user) names. If no list is given, only your requests are listed. Possible list formats are:|
|user_name||a user on the local system|
|sys!user_name||a user on system sys|
|sys!all||all users on system sys|
|all!user_name||a user not on the local system|
|all!all||all users not on the local system|
|all||all users on the local system|
|-v[list]||Displays the name of each printer and the pathname of the device where the printer is physically connected. The list contains printer names. If no list is given, all printers are displayed.|
The lists used in the options can be in one of two forms:
For example, to list requests for users bill and yourself (mylogin), you would type:
lpstat -u"bill mylogin"
lpstat -u"bill, mylogin"
Enabling and Disabling printers
Some systems are set up to allow users to use two additional lp subsystem commands. These commands are enable and disable. They can be used to change the state of a printer.
The disable command prevents the specified printer from accepting further requests. If also stops the processing and printing of the current request and any queued requests.
The enable command starts the printer on the first request in the queue and allows new requests to be spooled to the printer.
The command formats are:
enable printer disable [ -c ] [ -r[reason] ] printers
The -c cancels all currently printing requests on all printers listed. The -r provides a reason why the printer was disabled so lpstat will inform users appropriately. The commands are considered administrative commands by some and user commands by others. Check with your system administrator for how they are used at your site.
Refer to the cancel and lp commands described in module 12 and 79.
The files in the /usr/spool/lp/request directory are viewed to present request status. The /usr/spool/lp/* directory contains information files on printers and devices.
You can use the lpstat command to see if your request has been processed. It is useful to see how many requests are queued in front of yours. It can tell you what printers are installed and which ones are available at your site. You may decide to cancel a request and cannot remember the request ID. In this situation use lpstat to reveal the request ID.
In this activity you use the lpstat command to see what printers are installed at your site and what requests are currently queued for printing. Begin at the shell prompt.
cj> lp /etc/passwd request id is lj-419 (1 file)
cj> lpstat -t scheduler is running system default destination: lj device for lj: /dev/tty001 device for dp: /dev/tty002 lj accepting request since Aug 15 08:32 dp accepting request since Aug 23 09:58 printer lj now printing lj-419. enabled since Oct 15 12:03 printer dp is idle. enabled since Nov 3 10:23 lj-419 mylogin 5839 Nov 6 07:23 on lj
|Previous||Table of Contents||Next|