|HP-UX Reference > L
HP-UX 11i Version 3: February 2007
lpadmin — configure the LP spooling system
/usr/sbin/lpadmin -pprinter [options]
lpadmin configures LP spooling systems to describe printers, classes and devices. It is used to add and remove destinations, change membership in classes, change devices for printers, change printer interface programs, and to change the system default destination.
Exactly one of the -p, -x, -s, or -d options must be present for every legal invocation of lpadmin.
The following options are only useful with -p and can appear in any order. For ease of discussion, the printer is referred to below as printer P.
The following options are only useful with -p and can appear in any order. They are provided with systems that provide remote spooling.
When creating a new printer, the -v option and one of the -e, -i or -m options must be specified. Only one of the -e, -i or -m options can be specified. The -h and -l key letters are mutually exclusive. Printer and class names must not exceed 250 characters and must consist entirely of the characters A-Z, a-z, 0-9 and _ (underscore). The character set limitation is not applicable for the printer name passed as an argument to the -orp option. It is recommended that printer and class names consist of a maximum of 14 characters to ensure compatibility with other products that work with the LP spooling system.
For a remote printer, only one of -oci or -ocm can be specified. If neither of them is specified, the default remote cancel model /usr/lib/lp/cmodel/rcmodel is used. Similarly, only one of -osi or -osm can be specified. If neither of them is specified, the default remote status model /usr/lib/lp/smodel/rsmodel is used.
All local printers use four-digit request numbers. All remote printers use three-digit request numbers for contact with BSD systems.
Enabling and Disabling Email Notification
Email notification is enabled by default. To modify or query the email notification status, use lpadmin with the following options:
Following is a description of each of these options:
Model interface programs are supplied with the LP software. They are shell procedures, C programs, or other executable programs that interface between lpsched and devices. All printer models reside in directory /usr/lib/lp/model and can be used without modification with lpadmin -m. All cancel models reside in directory /usr/lib/lp/cmodel and can be used without modification with lpadmin -ocm. All status models reside in directory /usr/lib/lp/smodel and can be used without modification with lpadmin -osm. Models should have 644 permission if owned by lp and bin, or 664 permission if owned by bin and bin. Model file names must not exceed 14 characters. Alternatively, LP administrators can modify copies of models then use lpadmin -m to associate them with printers.
The LP model interface program does the actual printing on the device that is currently associated with the printer. The LP spooler sets standard input to /dev/null and standard output and standard error output to the device specified in the -v option of lpadmin. The interface program is then invoked for printer P from the directory /etc/lp as follows:
interface/P id user title copies options file ...
where arguments are as follows:
Given the command line arguments and the output directed to the device, interface programs can format their output in any way they choose.
When printing is completed, it is the responsibility of the interface program to exit with a code indicative of the success of the print job. Only return values of 0 indicating that the job completed successfully, or values of positive 1 through 127 indicating that some error was encountered that does not affect future print jobs should be used. Negative values and positive values greater than 127 are reserved for system use and should not be used by interface programs. lpsched notifies users by mail when there is an error in printing the request. If problems are detected that are likely to affect future print jobs, the interface program should return a error value. This will make lpsched disable the printer so that other pending print requests are not lost.
The cancel and status model interface programs perform the actual communication with the remote system to cancel requests or get the status of requests. See rcancel(1M) and rlpstat(1M) for command line arguments.
LANG determines the language in which messages are displayed.
If LANG is not specified or is set to the empty string, a default of "C" (see lang(5)) is used instead of LANG.
If any internationalization variable contains an invalid setting, lpadmin behaves as if all internationalization variables are set to "C" (see environ(5)).
Assuming an existing Hewlett-Packard laserjet printer named lp1, it will use the laserjet model interface through /dev/lp after the command:
/usr/sbin/lpadmin -plp1 -mlaserjet -v/dev/lp
Assuming a printer lp on a remote system system2, the command:
causes the spool system to use the local line printer lp3 and the model rmodel. The spool system also uses the model rcmodel to cancel remote requests and rsmodel to get status from system2. In addition, the remote system name system2 and the remote printer lp are used.
The following command performs the same operation as above.
Here the default remote cancel model rcmodel and the default remote status model rsmodel are used.
When installing remote printers, use the option -ocmrcmodel instead of -oci/usr/sbin/rcancel to specify the method used to cancel remote requests. The option -osmrsmodel should be used instead of -osi/usr/sbin/rlpstat to specify the method used for displaying remote status.
classes must not include remote printers. HP-UX systems do not have the ability to distribute print jobs in this way. Printing to a class of printers on a remote system (systemB for example) must be accomplished by creating the class on the remote system, then identifying that class by using a command resembling the following (although you might have to change some of the specific values shown in the example):