Online Book Reader

Home Category

UNIX System Administration Handbook - Evi Nemeth [427]

By Root 2861 0
sent. The users scott and evi, on the other hand, specified the class pr, so their jobs were sent to the first available printer in that class.

To stop lpsched for any reason, run lpshut as root or as the user lp. When lpsched is not running, no jobs will actually be printed, though lp can still queue jobs for printing. Jobs that are being printed when the daemon is stopped will be reprinted in their entirety when the daemon is restarted. To restart the daemon, run lpsched.

lpsched creates the file /var/spool/lp/SCHEDLOCK to indicate that it is running. If you try to start another copy of lpsched, it will notice that this file exists and refuse to run. If you stop lpsched by any means other than lpshut, you must remove the SCHEDLOCK file by hand before you can restart lpsched.

lpadmin: configure the printing environment


The lpadmin command tells the printing system about your printer configuration. It names printers, creates classes, and specifies the default printer. All the lpadmin command really does is create and modify a collection of text files that are found in the /var/spool/lp directory.

Despite the fact you can read these configuration files, they are a good place to practice the old adage “Look but don’t touch.” You should not try to edit them directly because they are very format sensitive and break easily.

The Solaris lpadmin tries to use a printcap-like file to make things easier to configure. But in fact, the Solaris system just spreads the configuration information out into two additional locations: /etc/printers.conf and /etc/lp.

Solaris wants lpsched to be running during most administrative commands. On the other hand, under HP-UX, most lpadmin commands will not work when lpsched is running, so lpsched must be stopped with lpshut before lpadmin is used. There appears to be no method to this madness.

Before the printing system can output jobs to a particular printer, it must be told that the printer exists. To add a new printer, execute

# /usr/sbin/lpadmin -pprinter -vdevice { -eprinter | -mmodel | -iinterface }

[ -cclass ... ] [{ -l | -h }]

where printer is the name of the new printer (both internally in the queuing system and at the level of user commands) and device is the file with which the printer is associated. device is usually a special file in /dev, but it can be any file.

The flags -e, -m, or -i tell the queuing system which printer interface program to use. The interface program is responsible for actually formatting jobs before they are sent to the printer. System V interface programs are analogous to BSD filters. The section Interface programs on page 726 goes into more detail.

The interface program can be specified in three ways:

-eprinter

In this case, printer is the name of an existing printer. This method of specifying the interface program is useful if you are adding a printer that is exactly like an existing one. The lpadmin command makes a copy of the interface program with the new destination’s name.

-mmodel

With this option, model is a type of device for which your system has an interface program. To determine which models your system supports, look in /var/spool/lp/model.

When a model file is specified, lpadmin makes a copy of the file /var/spool/lp/model/model to be used exclusively by that destination.

-iinterface

With the -i option, interface is the full pathname of a program that is to be used as the interface script. Most versions of lpadmin make a copy of the interface program, so if you want to change the program after you have run lpadmin, you must change the destination-specific copy and not your original.

HP-UX lets you specify programs that return status information and cancel printer jobs. These programs are specified like interface scripts, but different option prefixes are used (-ocm and -osm for cancel and status scripts, respectively).

lpadmin also accepts the following additional options:

-pprinter

tells lpadmin which printer or printers are being referred to. Combine this flag with other options to modify a printer.

Return Main Page Previous Page Next Page

®Online Book Reader