The following document details common procedures for monitoring and maintenance of printing on the UNIX operating procedures. The proper authorization, usually root access, is needed to carry out these procedures.
AUDIENCE
All personnel responsible for system administration should review this document.
REFERENCES
For more information the following sources are recommended:
UNIX Manual Pages (execute man lpstat, man lpc, man lpshut, or man lpsched at a UNIX command line)
PROCEDURE
Checking the Status of Printers and Print Queues
- To check the status of printers at the UNIX level, execute lpstat -t at a UNIX command line. The output for normally operating printers might look like the following:
scheduler is running ¬ Scheduler must be running for printing to occur
no system default destination ¬ A default printer can be defined; otherwise, printers must be specified in print commands
device for p_dplab_1: /dev/null ¬ UNIX device used for printing, usually /dev/null
device for ps_dpproj_1: /dev/null
device for ps_dpcon_1: /dev/null
device for p_dpcave_1: /dev/null
device for ps_qms: /dev/null
_p_dplab_1 accepting requests since Fri Dec 15 11:04:57 CST 1995_ ¬ Print requests are accepted but not necessarily printed
ps_dpproj_1 accepting requests since Wed Feb 14 06:51:18 CST 1996
ps_dpcon_1 accepting requests since Thu Apr 4 08:43:31 CST 1996
_p_dpcave_1 accepting requests since Mon Mar 25 14:30:16 CST 1996_
ps_qms accepting requests since Mon Feb 19 07:48:16 CST 1996
printer p_dplab_1 is idle. enabled since Mon Mar 25 11:02:13 CST 1996. available. ¬ Printers are printing requests
printer ps_dpproj_1 is idle. enabled since Tue Mar 19 08:03:24 CST 1996. available.
printer ps_dpcon_1 is idle. enabled since Thu Apr 4 08:43:31 CST 1996. available.
printer p_dpcave_1 is idle. enabled since Mon Mar 25 14:30:16 CST 1996. available.
printer ps_qms is idle. enabled since Mon Feb 19 07:48:16 CST 1996. available.
_p_dpcave_1-9574 root 2460 Apr 04 08:55_ ¬ Print requests in the print queue
- To specifically check the status of output requests, execute lpstat -o at a UNIX command line. If nothing is in the queue, there is no output. Otherwise, the output for one print request in the queue might look like the following:
_p_dpcave_1-9574 root 2460 Apr 04 08:55_
Deleting One Particular Print Job
To delete a particular print request from the print queue:
- Obtain the ID for the print request, for example _p_dpcave_1-9574_. You may use the lpstat command.
- At the UNIX command line, execute cancel <ID>.
Note that you can also delete print jobs associated with a particular user with the command cancel -u <user>.
Stopping or Starting Printer Services
- To stop all printer services, execute lpshut at a UNIX command line.
- To start all printer services, execute /usr/lib/lpsched at a UNIX command line
Cleaning Out All Print Queues
The following procedure cleans out all print jobs in the UNIX print queues:
- Log in as root.
- Execute lpshut at a UNIX command line to shut down UNIX print services.
- Execute cd /var/spool/lp/requests to change to the printing spool directory.
- Type pwd to make sure that you are in the /var/spool/lp/requests directory, and execute rm -r * to delete all print queues.
- Execute cd ../tmp to change to the temporary printing spool directory.
- Type pwd to make sure that you are in the /var/spool/lp/tmp directory, and execute rm -r * to delete all print queues.
- Execute /usr/lib/lpsched to restart printer services.
Checking the Status of Printers and Print Queues Using the lpc Utility
An alternative method to check the status of printers at the UNIX level, execute /usr/ucb/lpc at a UNIX command line to bring up the lpc utility. The lpc utility is active when the prompt is lpc>. (You may display the possible commands by typing ? at the prompt. Type exit to leave the tool.) To see status information, type status. The output for normally operating printers might look like the following:
lpc> status
_p_dplab_1: _ ¬ Printer name
queueing is enabled ¬ Printer requests are accepted but not necessarily printed
printing is enabled ¬ Printer is printing requests
no entries
ps_dpproj_1:
queueing is enabled
printing is enabled
no entries
ps_dpcon_1:
queueing is enabled
printing is enabled
no entries
_p_dpcave_1:_
queueing is enabled
printing is enabled
3 entries in spool area ¬ Number of requests in the printer’s queue
ps_qms:
queueing is enabled
printing is enabled
no entries
Stopping or Disabling Printers Using the lpc Utility
Execute /usr/ucb/lpc at a UNIX command line to bring up the lpc utility. The lpc utility is active when the prompt is lpc>. (You may display the possible commands by executing ? in the utility. Type exit to leave the tool.)
- To prevent print requests from being accepted into a printer’s queue, type disable <printer name> at the prompt. Any print jobs already in the queue will still be printed. To start queuing again, type enable <printer name>.
- To stop the printer from printing any requests, type stop <printer name> at the prompt. All print requests will still be queued and will be printed when printing is enabled again. To start printing again, type start <printer name>.
- To stop queuing and printing simultaneously, type down <printer name> at the prompt. To start these printer services again, type up <printer name>.
Cleaning Out Printer Queues Using the lpc Utility
To clear out the printer queue using the lpc utility, execute /usr/ucb/lpc at a UNIX command line. The lpc utility is active when the prompt is lpc>. (You may display the possible commands by executing ? in the utility. Type exit to leave the tool.) Type clean <printer name> at the prompt. This will delete all print requests in the queue. Often bringing the printer down and up also helps when there is a runaway job.