UNIX System Administration Handbook - Evi Nemeth [432]
# lpstat -p printername
Printing from Solaris to a BSD print server
To allow spooling from Solaris to a remote lpd server (either one running on another host or one inside a network printer), use the Solaris-specific -s flag to lpadmin. This flag lets you specify a remote printer as server!printer. Your shell will probably require you to escape the exclamation mark with a backslash, so the actual command will look like this:
# lpadmin -p howler-lw -s beast\!howler-lw -I PostScript,simple -T PS
-D "howler-lw via beast"
If the printer is to have the same name on the server and the local machine, you can omit the !printer part of the command (“\!howler-lw” in this case).
Once the remote printer has been defined, start it up as usual:
# enable howler-lw
# accept howler-lw
Finally, test the new printer.
# lp -dhowler-lw /etc/motd
# lpstat -phowler-lw
If you have a network printer that doesn’t support lpd, it probably expects output to be shoveled to it through a raw TCP connection. Solaris supports this configuration with the netstandard interface program. netstandard delivers the print job across the network, so the local device specified with the -v flag can be set to /dev/null.
The lpadmin -o flag is passes options to netstandard. For example, the following command creates a new PostScript printer called dinger-lw for a network printer that accepts raw PostScript on TCP port 9100:
# lpadmin -p dinger-lw -v /dev/null -I PostScript -T PS -m netstandard
-o protocol=tcp -o dest=dinger-lw:9100 -o timeout=15
The netstandard interface also supports sending jobs to a BSD lpd server through the notation lpadmin -o protocol=bsd. You will probably not have to use this feature, however, since lpadmin -s provides the same functionality.
Making Solaris accept network print jobs from BSD
Solaris includes a daemon called in.lpd that runs from inetd by default. This server understands the lpd protocol and can seamlessly spool jobs from lpr clients to local or network printers. in.lpd reads its configuration from /etc/printers.conf, so no configuration beyond lpadmin is necessary. If you do not intend to provide printing services to lpd clients, comment out the in.lpd line in /etc/inetd.conf.
Adding printers to HP-UX
In addition to a full implementation of the conventional SysV commands, HP-UX offers several unique client commands and a feature-rich server. HP-UX doesn’t like administrative changes to be made while lpsched is running.
The lpana command analyzes the performance of the print spooler. This tool provides enough information to actually be useful for optimization of your print spooler system; it includes statistics such as the average wait time of jobs in the queue and the average printing time of a job. To record the accounting data needed by lpana, run the lpsched daemon with the -a flag.
The lpfence command defines a minimum priority that incoming jobs must have in order to be printed. The fence is set for a printer, whereas job priority is set for a job. lpfence can only be run when lpsched isn’t running.
Jobs that have been spooled but have not started printing can be altered with the lpalt command. lpalt lets you change most of the lp options, saving the user from having to cancel and respool jobs that require adjustment.
As in Solaris, the HP-UX version of lpadmin supports the -o flag to pass parameters to an interface program. The -o flag is a nice feature, since it means that the sysadmin is not forced to edit scripts or recompile interface programs just to change their options. See page 731 for an example.
Setting up a local serial printer under HP-UX
Suppose we have connected our HP LaserJet 4M to the serial port associated with /dev/ttyp2. Before running lpadmin, we must stop all printing services:
# /usr/sbin/lpshut
An interface model already exists for printing to HP LaserJet 4 printers in the /usr/lib/lp/model directory, so we’ll use lpadmin -m to configure the printer:
# /usr/sbin/lpadmin -phowler-lw -mlaserjet4