Prevents users except the superuser from putting new jobs into a specified printers queue. Existing jobs continue to print, so this command is useful when a printer needs to
be turned off.
enable printer
Allows users to spool jobs to the queue again, restoring normal operation after the disable command is issued.
down printer
Stops printing and disables the queue for a specified printer its action is equal to disable plus stop.
up printer
Enables the queue and starts printing on the specified printer its action is equal to enable plus start.
If the specified printer is all, the command itself is forwarded to every printer on the system.
10.1.2 System V Printing Subsystem
The System V spooling subsystem has the following major components: User commands:
lp Initiates print requests equivalent to lpron BSD
lpstat Lists print queue contents equivalent to lpqon BSD cancel Cancels a pending print request equivalent to lprmon BSD
When a user submits a print request, it is assigned a unique request ID that is used to identify it thereafter; request ID s usually consist of the printer name and a request number.
•
The spooling daemon lpsched, responsible for carrying out print requests by sending data to the appropriate printer.
•
A suite of administrative commands accept, reject, enable, disable, lpadmin, lpmove, lpusers usually stored in the directory usrlib. It is a good idea to add this directory to the
roots command search path, which makes sense, because administrative printing commands require superuser privileges.
•
Spooling directories in usrspoollprequest for each printer, named by the printer name. Only the print request information is stored in the corresponding directory; by default, the
actual file to print is not copied. Thus, changing or deleting a file before it is printed affects the final output. The lp option −c can be used to force the copying of the file to the spooling
area when it is submitted for printing. •
10.1.2.1 The lp, lpstat, and cancel Commands
Print requests are sent to the queue for a destination, which can be either a specific printer including the default one, or a device class a group of the same type of printers. A device class
provides the mechanism to group similar printing devices and declare them to be equivalent to, and substitutable for, one another. Printing is performed on the first available device in the class — for
example, class laser can include all of the compatible laser printers on the system. All of the devices within a device class share a single queue.
The lp command places a print request into a queue, either for a specific device or adevice class:
lp [options] file−name
where 222
options Many options are available, but −d printer specifies the printer queue for printing;
if this is missing the default printer is used.
The lpstat command will provide status information on current printing queues and devices:
lpstat options
The lpstat command is more versatile than its BSD counterpart; there are a number of options that make this command a printing monitoring tool. The command will monitor not only the print queue
status, but can handle printers themselves, as well.
The lpstat options are: Option
Meaning −a [list] Display the acceptance status of the destinations for output requests for printers and
classes specified in the list
−c [list] Display the members of the classes specified in the list −o [list] Display print requests; the list may include request IDs, printer names, and class names
−p [list] Display the current status of the printers specified in the list −u [list] Display the status of all jobs belonging to the users specified in the list
−v [list] Display the name of printers and the pathnames of the associated devices −s
Summary; display all classes and their members and all printers and their associated devices
−t
Display all status information reports everything
−d
Display the default printer destination
−r
Display the status of the printer spooling daemon Note: list specifies one or more comma separated printing entities.
Here is an example: a number of printers, mostly remote ones, are defined on the HP−UX 10.20 printing−client system. The partial lpstat summary report on printers and their special device files
presented below includes local printers indicated in bold letters, and other remote printers.
lpstat −s
system default destination: lp26 device for lp1: devnull
remote to: lp31 on ps3.printview.com device for lp26: devnull
remote to: lp26 on ps3.printview.com device for lp29: devnull
remote to: lp29 on printhost.printview.com device for foxy: devnull
remote to: LF1 on foxip.printview.com device for poprt3: devtty3
= local printer
device for poprt8: devtty8 = local printer
device for wprt1: devnull remote to: LF1 on wprip.printview.com
device for xerox: devnull remote to: xerox on ps5.printview.com
..... .....
A partial report on the printers current status for the same printers in the previous report is:
lpstat −p
223
fence priority: 0 printer poprt3 disabled since Mar 12 16:46 −
reason unknown fence priority: 0
printer poprt3 is idle. enabled since Mar 15 11:45 fence priority: 0
printer wprt1 is idle. enabled since May 6 14:47 fence priority: 0
printer xerox is idle. enabled since May 14 05:41 fence priority: 0
printer lp26 is idle. enabled since Aug 26 12:38 fence priority: 0
printer lp1 is idle. enabled since Jan 27 10:44 fence priority: 0
printer lp29 is idle. enabled since Nov 24 14:12 fence priority: 0
..... .....
Finally, the lpstat −t command reports on everything. However, if there are a large number of attached printers and especially if some remote printers are down, the command itself can take a
long time to execute. In critical situations, when every second counts, it may be preferable to manually cancel pending print requests.
A system administrator may cancel any pending print request with the command:
cancel request−ids
or
cancel destination
where
request−ids The IDs of the jobjobs to be canceled even if they are currently printing destination
The name of the queue for which all jobs should be canceled
Solaris 2.x even supports the lpr command, this time adjusted to the System V LP environment. This means that the command is serviced by the lpsched daemon there is no lpd daemon or
printcap database. The −s option makes the command behave like the System V version: it does not copy the file to be printed into the spooling directory.
10.1.2.2 The lpsched Daemon The printer spooling daemon lpsched is responsible for carrying out print requests by sending data
to the appropriate printerprinters. It is also known as the print service daemon. The lpsched daemon under System V is actually the equivalent to the lpd daemon under BSD. The daemon is
invoked during the system booting and is permanently running, waiting for new print requests to be stored in the spooling queues.
Each printing−related administrative action requires the lpsched daemon to temporarily shut down and restart. The special lpshut command was introduced to make this simpler; the lpsched
daemon can be stopped with lpshut command.
224
There is no System V equivalent to the BSD lpc utility; instead, a number of individual administrative printing−related commands are available. Together they form an extremely powerful
and versatile suite of high−level commands to provide full control over the administration of various printing issues. The System V printing subsystem configuration also fully relies on these
administrative commands. While the BSD printing subsystem requires a direct access to and interaction with printing−related configuration datafiles, on System V all that is somewhat hidden
from the administrator, and provided by these front−end administrative commands. We will return to these issues later.
For example, the System V printing subsystem enables the user to move a pending print request between print queues i.e., printers with the special command lpmove there is no BSD
equivalent:
lpmove request−ids new−printer To move some print requests lpmove old−printer new−printer
To move all print requests where
request−ids The IDs of the print requestrequests to be moved new−printer The name of the new printer queue to move print requests
old−printer
The name of an old printer queue where print requests are pending
Another command pair, accept and reject, may be used to permit and inhibit spooling to a print queue; both accept a list of destinations as their argument. With the −r option, reject may specify a
reason for denying requests, which will be displayed to users attempting to send new jobs to that queue.
The enable and disable commands are used to control the status of a specified printing device printer.
The master printing−related administrative command is lpadmin. This command is so powerful that it is even more appropriate to refer to it as an administrative tool, a set of joined commands
invoked through different lpadmin options. This is the magic command for managing all printing devices in the System V printing subsystem.
The lpadmin command is used to manage printers and destination classes. It defines and modifies the characteristics of printer devices and classes. All these administrative tasks are important for the
printing subsystem and require full support by the lpsched daemon; any possible problem can be skipped with this command, but only when the lpsched daemon has been stopped. Once the
daemon is restarted, it has learned about the new configuration.
The lpadmin command is a powerful tool in managing printing devices. The online manual pages contain a complete explanation of all available options for this command. Here, only some of
options are listed and briefly discussed.
To set the default destination:
lpadmin −d printer_name
•
where
225
To place a printer into a class if the class does not exist it is created:
lpadmin −p printer_name −c class_name
•
where
printer_name The name of the printer class_name
The name of the class To remove a printer from a class:
lpadmin −p printer_name −r class_name
• To restrict or even deny access to destinations to specific users by default, all users are
allowed to use any destination:
lpadmin −p printer_name −u allow:user_list lpadmin −p printer_name −u deny:user_list
•
where
user_list List of users with restricted access to printer print_name; users in the list are separated
by commas. Each user in the list is specified in the form: hostuser−name, where host is the name of the host, and username indicates the user on that host a missing host
corresponds to the local system. The keyword all corresponds to all users, or all hosts. If an allow list exists, the access is allowed only to users in the list.
Finally, the lpadmin command is used to add a new printer local or remote to the system, as well as to remove a printer from the system. We will discuss this important administrative
task later. •
It is important to remember that the proper use of the lpadmin command involves shutting down the lpsched daemon, and reinvoking it afterward.
10.2 Printing Subsystem Configuration