11    Administering the Print Services

This chapter describes how you set up and administer the files and programs that make up the Digital UNIX print services. You can set up and administer the print services immediately after a new installation or upgrade to a new version of the operating system, or you can wait until later. For example, you can wait until you have installed a printer and have gathered the information about its characteristics that you need to set it up.

The first part of this chapter describes how to use the lprsetup utility to add a print device and automatically set up the print environment. The second part of this chapter discusses the routine print services administration that you can perform, using either the lprsetup utility or by editing system files. The last part of this chapter contains detailed reference information about the lpd print daemon and the system files associated with the print services.


Note

You can also use the SysMan printconfig command to perform some of these tasks.



11.1    Administrative Tasks

To set up the print system in a Digital UNIX operating environment, you perform tasks such as:


11.2    Interfaces to Print Services

There are several ways you can administer print services:


11.3    Print Services Commands

Unless you are using the CDE Desktop Print Configuration application, you use the following commands to manage the print system:

Refer to the lprsetup(8), lpc(1), lpr(1), lprm(1), lpq(1), and lpstat(1) reference pages for more information about these commands.

After a printer is set up and running on your system, you need to:


11.4    Using lprsetup to Set Up the Print System

This section describes the information you need in order to use the lprsetup utility to connect a printer to your computer. Before proceeding, verify that the printer is physically connected to your system, accessible on the network (for remote printing), and has been tested as described in the owner's manual.

To use the lprsetup utility, you must have the Printer Support Environment subset installed. To see if you have this subset installed, enter:

# setld -i | grep OSFPRINT
If the OSFPRINT subset is installed, the following information is displayed:
OSFPRINT400     installed       Local Printer Support (Printing Environment)

If the OSFPRINT subset is not installed, see the Installation Guide for information on adding this, or any, subset with the setld utility.


11.4.1    Gathering Information

Before adding a printer, you need to gather the information about the printer that you will need to interact with the lprsetup program. The lprsetup program updates the information in the /etc/printcap file using the information you supply.

If your system is part of a network, you may need to consult your local network administrator about the correct procedure for adding a printer.

The following is a list of the information you need:

If you are adding a remote printer, you need the name of the machine the printer is connected to (host name) and the remote printer queue name.

The following sections describe how you obtain the required information.


11.4.1.1    Printer Name

The printer name is the name by which you want to identify the printer through the lpr command. For example:
# lpr -Pprintername
The lprsetup program uses an internal numbering scheme from 0 to 99. The next available number is the default name. You can choose the default by pressing the Return key or by entering any other alphanumeric name that is appropriate. The lprsetup program always assigns at least two printer synonyms: the default number and 'lp default number', plus any others you specify. If the default number were 1, the two names would be '1' and 'lp1'. This printer could then be identified with 'lpr -P1' or 'lpr -Plp1'.

If you have only one printer or are entering the first of many printer names, the first name will have a printer number of 0. This is recognized as your system's default printer and will have an additional name of 'lp'. This means if you use the lpr command without specifying a specific printer this is the one it will use.

If this is the first printer connected to your system or a new printer added to an existing print system, create names that do not conflict with existing printer names. Ask your network administrator for the names of the remote printers on the network.


11.4.1.2    Printer Type

The printer type corresponds to the product name of the printer, such as the LN03 laser printer. If you are using the lprsetup program, printers are listed by type and only those supported by Digital are listed. These printers have some default values already included in the setup program.

The supported printer types are defined in Table 11-1.

Table 11-1: Supported Printer Types
Printer NameAbbreviation
LA50  la50 
LA70 Personal Printer  la70 
LA75 Plus Companion Printer  la75 
LA324 MultiPrinter  la324 
LA424 MultiPrinter  la424 
ColorMate PS  lf01r 
LG02 Line Printer  lg02 
DEClaser 2200  lg06 
LG12 Impact Line Matrix Printer  lg12 
LG31 Line Printer  lg31 
LJ250 Companion Color Printer  lj250 
LN03 Laser Printer  ln03 
LN03 Laser Printer  ln03s 
DEClaser 2100  ln05 
DEClaser 2200  ln06 
DEClaser 1100  ln07 
DEClaser 3200  ln08 
DEClaser 5100  ln09 
LN03 PostScript Printer  ln03r 
DEClaser 2150  ln05r 
DEClaser 2250  ln06r 
DEClaser 1150  ln07r 
DEClaser 3250  ln08r 
DEClaser 5100  ln08r 
IBM Proprinter  ibmpro 
NEC Silentwriter Model 290  nec290 
Epson FX-80  fx80 
Epson FX-1050  fx1050 
HP LaserJet Model IIP  hpIIP 
HP LaserJet Model IIIP  hpIIIP 
HP LaserJet Model IIID  hpIIID 
HP LaserJet Model IV  hpIV 
HP LaserJet Model 4M  hp4m 
any remote printer  remote 
default printer  unknown 

You can set up other printers by using 'unknown' and then responding to the prompts, using values similar to those for supported printers.

Responding with 'remote' allows you to designate a remote system for printing. In this case, only four printcap file entries are required:

The lp parameter must be present to print to a remote printer.

Responding with 'printer?' allows you to enter a mode where more information can be requested for each printer type. In this mode you are prompted to enter the same printer types as listed in the previous table. Information about the printer and the default printcap file entries for that printer are displayed. Enter 'quit' to return to the prompt to select the printer type being added.

When specifying the printer type, you must use full command names and printer names. The default printer type is 'unknown'.

To install third-party printers, consult the documentation that came with the printer.


11.4.1.3    Printer Synonyms

The printer synonym is an alternate name for the printer. Some examples include 'draft', 'letter', and 'LA-75 Companion Printer'. You can enter as many alternate names for a printer as you like, but the total length of the line containing all the names must be less than 80 characters. When entering printer synonyms that can consist of many names, the entry process is terminated when you either enter a blank line or enter a line containing only white space.

After entering a synonym, you are prompted again. If you do not want to enter any more synonyms, press Return to continue.

Each synonym (including the printer number) identifies the printer to the print system. For example, if you chose the synonym 'draft' for a printer, the following command prints files on this printer:

$ lpr -Pdraft files


11.4.1.4    Device Special File

The device special file provides access to the port on the computer to which the printer is connected. The device special file is used if the printer is directly connected to a local serial or parallel port. In this case, you must equate a printer device logical name to the printer's device special file name by using the lp symbol in the /etc/printcap file. For example:
lp=/dev/lp

The installation procedure creates some device special files for the hardware that is connected to your computer. Usually, the device special files for parallel printers are named /dev/lpn (for example: lp1, lp2, lp3), and the device special files for serial line printers are named /dev/ttynn (for example: tty00, tty01, tty02). The n and nn variables specify the number of the printer.

When you use lprsetup, the program defaults to the next consecutive number when it sets up this file. For example, the default device pathname for the third serial line printer is /dev/tty03.

The default device special file is /dev/lp, which specifies a parallel printer.

For remote printers, you should specify a null argument with the lp symbol. For example:

lp=

Note

If the port is used for logins, the lprsetup script turns off the terminal line established by the getty process so the terminal line can be used for a printer.



11.4.1.5    Printer Accounting

The af parameter specifies the name of the accounting file used to keep track of the number of pages printed by each user for each printer. The name of the accounting file should be unique for each printer on your system. Use the pac program to summarize information stored in the printer accounting files. This file must be owned by user daemon and group daemon, which it will be if you use the lprsetup program to specify the printer accounting file.

The af parameter is not applicable for remote printer entries because the accounting policy for remote printers is employed at their (remote) systems.

Accounting is accomplished through programs called print filters. The lprsetup script does prompt you for the line print filter information. You must specify this information when you are prompted at the end of the lprsetup display for symbols to modify. Two print filter symbols, if and of, are needed for accounting. You modify them at this point. For example:

if=/usr/lbin/ln03rof
of=/usr/lbin/ln03rof
If you want to use separate accounting files for each printer on your system, the file names must be unique. However, an unlimited number of printers can share an accounting file. You cannot specify an accounting file for remote printers.

Accounting files must be owned by the print daemon. If you specify an accounting file, intermediate directories are automatically created as needed.


Note

Printer accounting does not work for PostScript files.



11.4.1.6    Spooler Directory

The sd parameter specifies the spooling directory where files are queued before they are printed. Each spooling directory should be unique. All printcap file entries must specify a spooling directory, both local and remote.

When the spooling directory is created, intermediate directories are created as necessary.


11.4.1.7    Error Log File

The lf parameter specifies the log file where errors are reported. The default log file, if one is not specified, is /dev/console. If you have more than one printer on your system, give each log file a unique name.

When the error log file is created, intermediate directories in the pathname are created as necessary.


11.4.1.8    Connection Type

The ct parameter specifies the type of connection to the printer. You can connect a printer directly to your computer from a port or terminal line. You can access networked printers that are connected to a LAT (Local Area Transport) terminal server or to a remote host. If you are using lprsetup, the choices for the connection type are:

The lprsetup program supplies the default value dev.


11.4.1.9    Baud Rate

The baud rate is the maximum rate at which data can travel between the data source and the printer (for example, 4800 or 9600). The default baud rate for your printer should appear in the printer documentation. If you reset this baud rate yourself during the installation of the printer hardware, the rate that you set on the printer must match the rate that you enter in the /etc/printcap file.

You specify a baud rate only for serial printers that are directly connected to your computer. Baud rates are not specified for printers connected to the console port or connected by a parallel port or LAT port.


11.4.2    Using lprsetup to Install a Printer

This section describes how to install a printer locally (directly connected to your computer) using the lprsetup program. You can also use this program to modify a printer's configuration or remove a printer. These other tasks are described in
Section 11.5.

Digital recommends that you accept the default values for an initial printer installation.

The printer described in the following example is an LN03R.

You can run the lprsetup program three ways:

You must have superuser privileges to run the lprsetup program. Depending on the type of printer you are adding and the information you provide, the lprsetup program might do the following: When you run the lprsetup script, the first display is the main menu:
# /usr/sbin/lprsetup
Digital UNIX Printer Setup Program

Command < add modify delete exit view quit help >:

The lprsetup command options are described in Table 11-2.

Table 11-2: lprsetup Options
CommandDescription
add  Adds a printer 
modify  Modifies an existing printer's characteristics 
delete  Removes an existing printer from your configuration 
exit  Exits from the lprsetup program 
view  Displays the current /etc/printcap file entry for the printer you are configuring 
quit  Exits from the lprsetup program 
help  Displays online help about the lprsetup program 
You can abbreviate any command option with its initial letter.

You can enter information at each prompt or press Return to select the default information provided. (In most instances, you can accept the defaults.) You can also enter a question mark (?) to get a description of the information you specify at the prompt.


Note

Some of the symbols displayed in the lprsetup script are not supported by the Digital UNIX operating system. Refer to Table 11-4 and to the printcap(4) reference page for information on the supported symbols.


The following example shows how to use the lprsetup command to set up an LN03R printer to be used by the local system:

# /usr/sbin/lprsetup 
Digital UNIX Printer Setup Program


Command  < add modify delete exit view quit help >: add

Adding printer entry, type '?' for help.


Enter printer name to add [0] : [Return]

For more information on the specific printer types
enter `printer?'

Enter the FULL name of one of the following printer types:

la50   la70   la75   la324  la424  lg02   lg06   lg12
lg31   lj250  ln03   ln03s  ln05   ln06   ln07   ln08
lf01r  ln03r  ln05r  ln06r  ln07r  ln08r  ibmpro nec290
fx80   fx1050 hpIIP  hpIIIP hpIIID hpIV   hp4m   remote
unknown

or press RETURN for [unknown] : ln03r

Enter printer synonym: tomf

Enter printer synonym: [Return]

Set device pathname 'lp' [] ? /dev/tty01

Do you want to capture print job accounting data ([y]|n)? y

Set accounting file 'af' [/usr/adm/lpacct]?[Return]

Set spooler directory 'sd' [/usr/spool/lpd] ? [Return]

Set printer error log file 'lf' [/usr/adm/lperr] ? [Return]

Set printer connection type 'ct' [dev] ? [Return]

Set printer baud rate 'br' [4800] ? 9600

After you respond to each of the prompts, lprsetup prompts you to determine if you want to change any of the values assigned to the various symbols in your /etc/printcap file or if you want to specify any additional symbols. For example, you can set a specific page length or width. If you want to make any changes or add information, enter the appropriate symbol name. Refer to the printcap(4) reference page or Table 11-4 for more information on the various symbols.

Enter the name of the printcap symbol you wish to modify.  Other
valid entries are:
        'q'     to quit (no more changes)
        'p'     to print the symbols you have specified so far
        'l'     to list all of the possible symbols and defaults
The names of the printcap symbols are:

 af  br  cf  ct  df  dn  du  fc  ff  fo  fs  gf  ic  if  lf  lo
 lp  mc  mx  nc  nf  of  op  os  pl  pp  ps  pw  px  py  rf  rm
 rp  rs  rw  sb  sc  sd  sf  sh  st  tf  tr  ts  uv  vf  xc  xf
 xs  fo  ic  nc  ps  Da  Dl  It  Lf  Lu  Ml  Nu  Or  Ot  Ps Sd
 Si  Ss  Ul  Xf


Enter symbol name: q

        Printer #0
        ----------
Symbol  type  value
------  ----  -----
  af    STR    /usr/adm/lpacct
  br    INT    9600
  ct    STR    dev
  fc    INT    0177777
  fs    INT    03
  if    STR    /usr/lbin/ln03rof
  lf    STR    /usr/adm/lperr
  lp    STR    /dev/tty01
  mc    INT    20
  mx    INT    0
  of    STR    /usr/lbin/ln03rof
  pl    INT    66
  pw    INT    80
  rw    BOOL   on
  sd    STR    /usr/spool/lpd
  xc    INT    0177777
  xf    STR    /usr/lbin/xf
  xs    INT    044000

Are these the final values for printer 0 ? [y] y

Next, the lprsetup script prompts you to add comments to the /etc/printcap file. Enter n at the prompt if you do not want to add comments. Enter y at the prompt if you want to add comments. At the pound sign (#) prompt, enter your comment. Press Return at the pound sign (#) prompt to exit. The comments will be insert directly above the printcap entry in the /etc/printcap file.

Adding comments to printcap file for new printer, type '?' for help.

Do you want to add comments to the printcap file [n] ? : y

# Use this printer for draft-only

# [Return]

Set up activity is complete for this printer.
Verify that the printer works properly by using
the lpr(1) command to send files to the printer.


Command  < add modify delete exit view quit help >: view
# Use this printer for draft-only
pearly|lp0|3X27|tomw:\
        :af=/usr/adm/lpacct:\
        :br#9600:\
        :ct=dev:\
        :fc#0177777:\
        :fs#03:\
        :if=/usr/lbin/ln03rof:\
        :lf=/usr/adm/lperr:\
        :lp=/dev/tty01:\
        :mc#20:\
        :mx#0:\
        :of=/usr/lbin/ln03rof:\
        :pl#66:\
        :pw#80:\
        :rw:\
        :sd=/usr/spool/lpd:\
        :xc#0177777:\
        :xf=/usr/lbin/xf:\
        :xs#044000:
Command  < add modify delete exit view quit help >: exit

Refer to the lprsetup(8) reference page for more information on using the program.


11.4.3    Setting Up Remote Printers

You can use the lprsetup script to set up remote printers that are accessible from a Local Area Transport (LAT) or from a remote machine.

If you are setting up a remote printer from a remote machine, the local machine (the client) must be listed in the .rhosts file of the remote machine (the host).

If your printer will be connected to a remote LAT terminal server, ensure that the LAT subsets are installed as described in the Installation Guide. To see if the LAT subsets are installed, enter:

# setld -i | grep OSFLAT
See the Network Administration guide for information on how to enable remote LAT terminal server printing.


11.4.4    Testing Printers

Test your printer by using the lpr command to print a few pages of text. You should also test any special printer features that you intend to use regularly on this printer, for example, PostScript or double-sided print. Refer to the lpr(1) reference page for more information on how to invoke these features. Table 11-4 lists the printcap symbol names, the type of values they take, default values, and descriptions.

The lptest command writes a traditional ripple test pattern to the standard output, or you can direct the output to a printer. A pattern that contains all 96 printable ASCII characters in each column is printed using 96 lines. In the pattern, each printed character is displaced rightward one character column on each successive line. This test is also useful for ascertaining the number of lines per page and the default page parameters. You can use the ripple test pattern to test printers, terminals, and drive terminal ports during debugging.

The lptest command has the following syntax:

/usr/sbin/lptest[length[count]]

Use the lptest command if you need quick output of random data. For example:

# /usr/sbin/lptest |lpr -P3r44
Refer to the lptest(8) reference page for more information.


11.5    Routine Operations

The first part of this chapter showed you how to set up the first printer on a system. This section describes the routine administrative tasks for a print system that is already set up. You can use the lprsetup script to perform these tasks. You can also perform the tasks manually by editing system files and creating files and directories. If you are making many changes to the print system at one time, it may be easier for you to make the changes manually. The tasks described in the following sections are: Note that if you manually remove printers from the /etc/printcap file, you also have to remove spooling, accounting, and error directories and files.


11.5.1    Adding Printers

Once you have one printer set up, you can add other printers at any time. Gather the following information about each printer: You can add printers by running the lprsetup command or you can add printers manually by performing the following steps:

  1. Create a printer spooling directory. Refer to Section 11.6.2.2.

  2. Create the /etc/printcap file and edit it to include a description of the printer. Refer to Section 11.6.3.

  3. Create an accounting file and a log file and enable printer accounting. Refer to Section 11.5.4.

You should make sure that the /etc/inittab file does not invoke the getty process on serial lines that have printers attached. If you use the lprsetup script, this is done for you.


11.5.2    Modifying Printers

To modify a printer's configuration automatically, run the lprsetup program and choose the modify option from the main menu.
Section 11.4.2 describes how to use the lprsetup program.

If you change the name of the spooling directory, the accounting file, or the error log file, lprsetup asks you to verify that the information is correct before it deletes the original information.

To manually modify a printer's configuration, edit the /etc/printcap file and modify the entry that pertains to the printer. Refer to Section 11.6.3 and to the printcap(4) reference page for information about the /etc/printcap file symbols.


11.5.3    Removing Printers

To remove a printer, run the lprsetup program and choose the delete option from the main menu. The program prompts you for the printer name. Enter the name of the printer you want to remove. You are prompted for confirmation that you want to delete the error log file and the accounting file because these files can be shared by more than one printer. If you do have shared files, do not delete them. Section 11.4.2 describes how to use the lprsetup program.

If you have included comments for the printer in the first line of its /etc/printcap file entry, the lprsetup program does not delete them. You must edit the /etc/printcap file and delete the comments.

To manually remove a printer, edit the /etc/printcap file and delete the entry that pertains to the printer. You must also manually delete the accounting and log file and the spooling directory.


11.5.4    Enabling Printer Accounting

Printer accounting allows you to charge users for printing services and to determine the amount of printer usage.

There are two types of printer accounting: printer user accounting and printer summary accounting. Printer user accounting provides information about printer use according to the machine and user name that issues the print request. Printer summary accounting provides information about the amount of media (number of printed pages or number of feet of roll paper or film) the printer produces. You specify the pac command with the -s option to produce printer summary accounting information.

The printer accounting files default to the /var/adm directory. If you use the lprsetup program to add a printer, the program creates the accounting file you specify. The /usr/adm/lpacct file is the default accounting file. If you add a printer manually, you must create the accounting file.


Note

The /var/adm/printer directory should be owned by user adm and belong to group adm. The printer accounting files should have protection mode 644, be owned by user adm, and belong to group system.


Refer to
Chapter 13 for more information on using printer accounting.


11.5.5    Controlling Local Print Jobs and Queues

Use the lpc command to manage the print jobs and queues associated with the local printers on your system. You can use the lpc command to:

Some lpc commands, for example, the disable command, require you to be superuser.


Note

You can use the lpc command only to manage print queues that are local to your system. Although a remote printer has both a local queue and a remote queue, the lpc command manages only the local queue.


There are 15 command arguments that you can specify with the lpc command. You can also use the lpc command interactively. If you enter the lpc command without any command arguments, the lpc> prompt is displayed. You can then enter command arguments.

The lpc command has the following syntax:

/usr/sbin/lpc[argument] [all | printer . . .]

Some of the command arguments allow you to specify all to indicate all the printers or to specify one or more printer variables to indicate a specific printer.

You can specify the argument variables defined in Table 11-3.

Table 11-3: lpc Command Arguments
lpc ArgumentDescription
help [argument Prints a one-line description of the specified lpc command argument. If an argument variable is not specified, the list of arguments is displayed. 
? [argument Same as the help argument. 
abort  Terminates an active lpd daemon and then disables printing. This prevents the lpr or lp command from starting a new lpd daemon. 
clean  Removes any temporary files, data files, and control files that cannot be printed (for example, files that do not form a complete printer job) from the specified print spooling directory. 
disable  Turns off the specified print spooling queue. This prevents the lpr or lp command from entering new jobs in the queue. 
down message...  Turns off the specified print queue, disables printing, and enters the specified message in the printer status file. The message does not need to be quoted because remaining arguments are treated the same as echo. You can use the down argument to take down a printer and inform users. If a printer is down, the lpq command indicates that the printer is down. 
enable  Enables spooling for the specified printers. This enables the lpr or the lp command to enter print jobs in the spooling queue. 
exit  Exits from lpc
quit  Exits from lpc
restart  Attempts to start a new lpd daemon for the specified printer. This argument is useful if some abnormal condition causes the daemon to terminate unexpectedly and leave jobs in the queue. If this occurs, the lpq command indicates that no daemon is present. If a daemon is hung, you must first kill the process and then restart the daemon by using the restart argument. 
start  Enables printing and starts a spooling daemon for the specified printer. 
status [printer Displays the status of the specified printer daemon and queue. The status argument shows if the queue is enabled, if printing is enabled, the number of entries in the queue, and the status of the printer's lpd daemon. If a printer name is not supplied, information about all printer daemons and queues is displayed. 
stop  Stops a spooling daemon after the current job is complete and disables printing. 
topq printer  Puts print jobs in the queue in the specified order. You can specify the print jobs by also specifying a request_ID variable or a username variable. 
up  Enables all printing and starts a new printer daemon. Cancels the down argument. 

The following example shows that the lpd daemon is active on the printer named tester and there is one entry in the queue:

# /usr/sbin/lpc

lpc> status tester
tester:
        printer is on device '/dev/tty02' speed 9600
        queuing is enabled
        printing is enabled
        1 entry in spool area
lpc>
Refer to the lpc(8) reference page for more information.


11.6    Reference Information

This section contains information about the line printer daemon, lpd, and the system files that are required for print system operations. These files are created automatically if you use the lprsetup script, as described in
Section 11.4.2, or you can create and modify the files manually. Note that if you create files manually, you will also need to manually change the /etc/printcap file, so the changes can take effect.


11.6.1    Line Printer Daemon

Printers are controlled by the line printer daemon, lpd, which is located in the /usr/lbin directory. Printing cannot take place unless the lpd daemon is running. The lpd daemon has many functions: When you use the lpr command, the lpd daemon is activated, and the daemon copies the file to the printer's spooling queue or directory. Requests are printed in the order in which they enter the queue. A copy of the file to be printed remains in the queue until the printer is ready to print it; then the lpd daemon removes the file from the spooling queue and sends it to the printer.

After you install and boot your system, the lpd daemon is usually started by the init program. You can start the lpd daemon with the following command syntax:

/usr/lbin/lpd[-l]

The -l option causes the lpd daemon to log valid requests from the network. This option is useful for debugging.

To test whether the line printer daemon is running, enter:

# ps agx |grep /usr/sbin/lpd


11.6.2    Spooling Directories

Each printer must have its own spooling directory located under the /usr/spool/lpd directory. The spooling directory acts as a printer's spooling queue; it contains the files that are queued for printing on that printer. A printer spooling directory should have the same name as the printer reference name and must be located on the machine attached to the printer. The printer reference name is the name that you specify to print on a particular printer.

If you are using lprsetup, the program supplies the default value /usr/spool/lpdn. The n variable specifies the printer number. For example, the default name of the spooling directory for a second line printer could be /usr/spool/lpd2. The default spooling directory for any printer is /usr/spool/lpd.

Each printer entry in the /etc/printcap file should specify a spooling directory even if the printer is connected to another machine or is on another network. You specify a spooling directory with the sd symbol. For example:

sd=/usr/spool/lpd/purple

Spooling directories must have the same parent directory name, which is normally /usr/spool.


11.6.2.1    Spooling Directory Files

A spooling directory contains a status file and a lock file that are created by the lpd daemon when a file is queued for printing.
The lock file contains control information about the current print process. For example, it can inform the lpd daemon that the printer is printing a job. The lock file prevents the lpd daemon from invoking another job on the printer while a file is printing. The lock file contains the process identification number of the daemon that is currently running. The status file contains a line that describes the current printer status. This line is displayed if a user inquires about printer status. If a printer whose status is queried is not active, the status message written to standard output is no entries.

When the lpd daemon is activated as a result of a print request, it looks in the printer spooling directory for a lock file. If a lock file is not found, the lpd daemon creates one and writes the identification number and the control file name on two successive lines in the file. The lpd daemon then scans the printer spooling directory for command files whose names begin with cf. Command files specify the names of user files to be printed and contain printing instructions for the files. Each line in a command file begins with a key character that indicates what to do with the remainder of the line. The key characters and their meanings are described in detail in the lpd(8) reference page.

Data files, whose names begin with df, are also located in the spooling directory. Data files contain text formated for printing. These files are identified by their print request identification numbers only.

After a file is printed, the lpd daemon removes the control and data files from the printer spooling queue, updates the status file, and sets up the next file in the spooling queue for printing.

For example, if a printer named milhaus has jobs currently waiting to be printed, the following command lists the files that are stored in the spooling directory:

# ls -l /var/spool/lpd/milhaus
-rw-rw----   1    root      75  Jan 17  09:57  cfA0220mothra
-rw-rw----   1    root      96  Jan 17  10:03  cfA143harald
-rw-rw----   1    root  199719  Jan 17  09:57  dfA0220mothra
-rw-rw----   1    root    9489  Jan 17  10:03  dfA143harald
-rw-r--r--   1    root      20  Jan 17  10:06  lock
-rw-rw-rw-   1  daemon     113  Jan 17  10:00  status


11.6.2.2    Creating a Spooling Directory

If you want to manually add a printer, use the mkdir command to create the spooling directories for each printer. The spooling directory permission mode must be set to 775. The directory's group and ownership must be set to the name daemon. For example:
# cd  /var/spool/lpd

# mkdir lp1

# chmod 775 lp1

# chgrp daemon lp1

# chown daemon lp1

# ls -l lp1
drwxr-xr-x  2  daemon  daemon  24  Jan 12  1994  lp1


11.6.3    The /etc/printcap File

The lpd daemon uses the /etc/printcap printer database file to print requests. Each entry in the file describes a printer. Printer characteristics are specified by 2-letter abbreviations called symbols. The symbols are described in this section and in the
printcap(4) reference page. The lprsetup program modifies the /etc/printcap file.

The following example shows an /etc/printcap entry for both a local printer and a remote printer:

#
#
lp|lp0|0|dotmatrix|mary:\
      :af=/usr/adm/printer/lp.acct:\
      :br#9600:\
      :ct=dev:\
      :fc#0177777:\
      :fs#023:\
      :if=/usr/lbin/la75of:\
      :lf=/usr/adm/lperr:\    [1]
      :lp=/dev/tty01:\
      :mx#0:\
      :of=/usr/lbin/la75of:\
      :pl#66:\
      :pw#80:\
      :sb:\     [2]
      :sd=/usr/spool/lpd:\
      :xc#0177777:\     [3]
      :xf=/usr/lbin/xf:\
      :xs#044000:\
#
#
sqirrl|3r3|ln03r3|postscript3|In office 2T20:\
      :lp=:rm=uptown:rp=lp:sd=/var/spool/printer/ln03r3:mx#0:\ [4]
#
The callouts in the /etc/printcap entry show the following possible symbol syntaxes:
  1. --> Specifies a symbol with alphabetic characters.

  2. --> Specifies a symbol that represents a Boolean expression.

  3. --> Specifies a symbol with a numeric value.

  4. --> Specifies an entry for a remote printer. The lp, rm, rp, and sd symbols are required for remote printers for which you are a client.

The first line of a printer entry contains the fields that specify the printer primary reference name and printer name synonyms. This first line and these fields are required for every printer, both local and remote.

The printer reference name is the name that you subsequently use in order to specify printing to this printer. You can give each printer as many alternative reference names as you want, but each field on the first line must be separated with a vertical bar (|). The first line must end with a colon (:).


Note

A local printer entry in the /etc/printcap file should have the default printer reference name lp0 so that print jobs can have a destination when printer reference names are not specified in print commands.


The remaining lines of each printer entry contain the descriptive symbols and values that define the printer's configuration. Symbols are 2-character mnemonics and can be specified with an equal sign (=) and alphabetic characters or with a number sign (#) and a numeric value. Some symbol names have Boolean equivalents, which do not use parameters. You can specify the symbols on one line or on individual lines, but you must separate them with colons (:).

To make the /etc/printcap file easy to read, you can place a colon (:) at the beginning of a line and a backslash (/\) at the end of a line to separate the symbols.

Table 11-4 lists the printcap symbol names, the type of values they take, default values, and descriptions.

Table 11-4: The printcap File Symbols
SymbolTypeDefaultDescription
af  alphabetic  NULL  Name of accounting file 
br  numeric  none  If lp is a tty, set the baud rate (ioctl call) 
cf  alphabetic  NULL  The cifplot data output filter 
ct  alphabetic  NULL  Connection type ° 
df  alphabetic  NULL  The TeX data filter (DVI format) 
dn  alphabetic  /usr/lbin/lpd  Specifies a nonstandard daemon pathname 
du  numeric  none  Specifies a nonstandard daemon UID 
fc  numeric  If lp is a tty, clear flag bits (sgtty.h
ff  alphabetic  /f  String to send for a form feed 
fo  Boolean  false  Print a form feed when device is opened (to suppress all form feeds, specify both the fo and sf symbols) 
fs  numeric  If lp is a tty, set flag bits 
gf  alphabetic  NULL  Graph data filter (plot format) 
ic  Boolean  false  Driver supports (nonstandard) ioctl to independent printout 
if  alphabetic  NULL  Accounting text filter 
lf  alphabetic  /dev/console  Error log file name 
lo  alphabetic  lock  Name of lock file 
lp  alphabetic  /dev/lp  Printer device logical name ° 
mc  numeric  20  Specifies the maximum number of copies allowed 
mx  numeric  1000  Maximum file size (in BUFSIZ blocks), zero (0) removes size restriction 
nf  alphabetic  NULL  The ditroff data filter (device independent troff) 
of  alphabetic  NULL  Output filtering program 
op  alphabetic  NULL  Entry in the reference name field for LAT port characteristics 

Table 11-5: The printcap File Symbols, continued
SymbolTypeDefaultDescription
os  alphabetic  NULL  Service name supported on some terminal servers 
pl  numeric  66  Page length (in lines) 
pp  alphabetic  NULL  The print command filter replacement 
ps  alphabetic  non_PS  Indicates that the printer is PostScript 
pw  numeric  132  Page width (in characters) 
px  numeric  Page width in pixels (horizontal) 
py  numeric  Page length in pixels (vertical) 
rf  alphabetic  NULL  The FORTRAN-style text file filter 
rm  alphabetic  NULL  Machine name for remote printer ° 
rp  alphabetic  lp  Remote printer name argument 
rs  Boolean  false  Restrict remote users to those with local accounts 
rw  Boolean  false  Open the printer device for reading and writing 
sb  Boolean  false  One-line banner 
sc  Boolean  false  Suppress multiple copies 
sd  alphabetic  /usr/spool/lpd  Spool directory 
sf  Boolean  false  Suppress all form feeds, except those that are in the file 
sh  Boolean  false  Suppress printing of burst page header 
st  alphabetic  status  The status file name 
tf  alphabetic  NULL  The troff data filter (catphototypesetter) 
tr  alphabetic  NULL  Print trailing string if queue empties (the trailing string can be a series of form feeds or an escape sequence) 
ts  alphabetic  NULL  LAT terminal server node name. 
vf  alphabetic  NULL  The raster image filter (you can also specify raster filters with the if and of symbols) 
xc  numeric  If lp is a tty, clear local mode bits (tty) 
xs  numeric  If lp is a tty, set local mode bits 


11.6.4    Line Printer Daemon Filter Directory

The filter directory for the lpd daemon translates data that you want to print into the format appropriate for your printer. You must specify the filter that matches each printer on your system. For example, to print files with the LN03R printer, you would use the ln03rof filter.

You can specify an accounting filter with the if symbols and an output filter with the of symbol. Output filters filter text data to the printer device if accounting is not enabled or if text data must be passed through a filter. For example:

if=/usr/lbin/ln03rof
of=/usr/lbin/ln03rof

Refer to the lpd(8) reference page for more information on using filter capabilities.

Table 11-6 lists the available print filters located in the /usr/lbin directory.

Table 11-6: Print Filters
Filter NameDescription
epsonof  Epson FX-80 and FX-1050 printers 
hplaserof  NEC Silentwriter Model 290 and most Hewlett Packard LaserJets 
hplaserpsof  Hewlett Packard PostScript-equipped LaserJets 
hplaser4psof  Hewlett Packard LaserJet Model 4M only 
lpf  Line printer filter (LP25, LP26, LP27, LP29, LG01, LA210, LQP02, LQP03) 
lqf  Letter-quality filter (LQP02, LQP03) 
la75of  Dot matrix printer filter (LA75, LA70, LA324, LA424) 
lg31of  LG31 line printer filter 
lg02of  LG02 ink jet printer filter 
ln03of  LN03 laser printer filter 
ln03rof  LN03 ScriptPrinter filter 
ln03rof_isolatin1  LN03 ScriptPrinter filter with ISO Latin_1 encoding 
ln03rof_decmcs  LN03 ScriptPrinter filter with DEC multinational character set encoding 
ln05of  DEClaser 2100 laser printer filter 
ln05rof  DEClaser 2150 PostScript printer filter 
ln05rof_isolatin1  DEClaser 2150 PostScript printer filter with ISO Latin_1 encoding 
ln05rof_decmcs  DEClaser 2150 PostScript printer filter with DEC multinational character set encoding 

Table 11-7: Print Filters, continued
Filter NameDescription
ln06of  DEClaser 2200 laser printer filter 
ln06rof  DEClaser 2250 PostScript printer filter 
ln06rof_isolatin1  DEClaser 2250 PostScript printer filter with ISO Latin_1 encoding 
ln06rof_decmcs  DEClaser 2250 PostScript printer filter with DEC multinational character set encoding 
ln07of  DEClaser 1100 laser printer filter 
ln07rof  DEClaser 1150 PostScript printer filter 
ln07rof_isolatin1  DEClaser 1150 PostScript printer filter with ISO Latin_1 encoding 
ln07rof_decmcs  DEClaser 1150 PostScript printer filter with DEC multinational character set encoding 
ln08of  DEClaser 3200 laser printer filter 
ln08rof  DEClaser 3250 PostScript printer filter 
ln08rof_isolatin1  DEClaser 3250 PostScript printer filter with ISO Latin_1 encoding 
ln08rof_decmcs  DEClaser 3250 PostScript printer filter with DEC multinational character set encoding 
ln09of  DEClaser 5100 PostScript printer filter 
ln09of_isolatin1  DEClaser 5100 PostScript printer with ISO Latin_1 encoding 
ln09of_decmcc  DEClaser 5100 PostScript printer with DEC multinational character set encoding 
lj250of  LJ250 DEColorwriter filter 
For printers not supplied by Digital, consult your printer manual for filter information.


11.6.5    Flag Bits

Flag bits specify characteristics about data transmission from the host to the printer and, if possible, from the printer to the host on a serial line only (LAT and RS232). Data that is passed from the printer to the host may include stop and start status information, which tells the host that the printer input buffer can accept input or that it is about to overflow.

Delays are specific times used to slow the transmission of the next group of characters to the input buffer. Delays give the printer mechanism time to perform operations such as a carriage return, newline, tab, and form feed.

Flag bits are cleared with the fc symbol and set with the fs symbol. All printers do not use all the flag bits, but you must either set the bits or clear them. You should consult your printer manual for specific information about flag bits.

The flag bits are specified as octal numbers in a 16-bit word. Octal values are preceded with the number zero (0). To clear all the bits, specify the value 0177777 with the fc symbol. To set all the bits, specify the value 0177777 with the fs symbol. All bits should be cleared (using fc#0177777) before calling the fs symbol. To set or clear any groups of bits, specify the octal sum of the combined bits for the number of flag bits.

The following is an example of flag bit specifications:

fc#0177777
fs#0141
As shown in the previous example, fc#0177777 clears all bits. The fs symbol set to 0141 specifies the OPOST, ONLRET, and OFILL flag bits.

Table 11-8 lists each flag bit name, its octal value, and its description.

Table 11-8: Flag Bits
FlagOctal ValueDescription
OPOST  0000001  Enable output processing 
ONLCR  0000002  Map NL to CR-NL 
OLCUC  0000004  Map lower case to upper case 
OCRNL  0000010  Map CR to NL 
ONOCR  0000020  No CR output at column 0 
ONLRET  0000040  NL performs CR function 
OFILL  0000100  Use fill characters for delay 
OFDEL  0000200  Fill is DEL, else NUL 
NLDLY  0001400  Newline delay 
NL0  0000000   
NL1  0000400   
NL2  0001000   
NL3  0001400   
TABDLY  0006000  Horizontal tab delay 
TAB0  0000000   
TAB1  0002000   
TAB2  0004000   
TAB4  0006000   
CRDLY  0030000  Carriage Return delay 
CR0  0000000   
CR1  0010000   
CR2  0020000   
CR3  0030000   
FFDLY  0040000  Form feed delay 
FF0  0000000   
FF1  0040000   
BSDLY  0100000  Backspace delay 
BS0  0000000   
BS1  0100000   
OXTABS  1000000  Expand tabs to spaces 

Refer to the tty(7) reference page for detailed information on flag bits.


11.6.6    Mode Bits

Mode bits specify details about the capability of a particular terminal and usually do not affect printer operation. Mode bits are cleared with the xc symbol and set with the xs symbol. Some printers use all of the mode bits, so you must either set them or clear them. The mode bits are specified as octal numbers in a 16-bit word format. You should clear all bits by specifying xc#0177777 before you specify the xs symbol.

Refer to the tty(7) reference page for a detailed description of the status bits.

The following is an example of mode bits specifications:

xc#0177777
xs#044000
As shown in the previous example, xc#0177777 clears all bits. The xs symbol set to 0110 specifies the ECHO and ECHOCTL mode bits.

Table 11-9 lists a description of each mode bit.

Table 11-9: Mode Bits
ModeOctal ValueDescription
ECHOKE  0000001  Echos KILL by erasing the line 
ECHOE  0000002  Visually erase characters 
ECHOK  0000004  Echoes NL after KILL 
ECHO  0000010  Enable echoing 
ECHONL  0000020  Echoes NL even if ECHO is off 
ECHOPRT  0000040  Echo erased chars between  and / 
ECHOCTL  0000100  Echo control characters as ^(char) 
ISIG  0000200  Enable special chars INTR, QUIT and SUSP 
ICANON  0000400  Enable canonical input 
ALTWERASE  0001000  Use alternate word erase algorithm 
IEXTEN  0002000  Enable FLUSHO and LNEXT 
XCASE  0040000  Canonical upper/lower presentation 


11.6.7    Remote Printer Characteristics

If a printer will be used by users on remote machines, /etc/printcap files on the local machine attached to the printer and on the remote machines that will use the printer must contain some network configuration information.

On the local machine attached to the printer you must specify the rs symbol, which specifies a Boolean value that takes only a true (yes) or false (no) value, along with the other printer configuration symbols. If you define the value as true, remote users must have an account on the local machine that is attached to the printer. If you define the value as false, remote users can access the local printer if the local printer is listed in the .hosts file. Refer to Section 11.6.3 for an example of an /etc/printcap file.

On the remote machine that will use the printer, you must specify the rm, rp, lp, and sd symbols.

The rm symbol specifies the name of the machine attached to the printer. For example:

rm=deccom

The rp symbol specifies the printer spool name on the remote system. For example:

rp=ln03lab

For remote printers, you should specify the lp symbol without a value:

lp=
The sd symbol specifies the spooling directory. For example:
sd=/usr/spool/lpd


11.6.8    Pagination and Imaging Parameters

Printer filters must know the size of an output page to perform proper page framing and line-feed and carriage returns (line folding).

For line printers, the pl and pw parameters specify the page length in number of lines (default is 66) and the column width in number of constant-width characters (default is 132), respectively. For example:

pl#55
pw#70

You should not specify a width of more than 80 characters for a letter-quality printer that uses 8 1/2-inch by 11-inch paper. If you specify a width that is greater than 80 characters on a printer, the page prints in landscape mode.

For high-resolution laser-type printers, the line length and page width parameters are py and px, which specify the number of pixels along the y- and x-coordinate planes of the printer output image area. Some printers can operate in either constant-width or imaging modes, so you must specify both sets of parameters. For example:

px#60
py#80

Refer to your printer's manual for its output characteristics.


11.7    Troubleshooting

This section provides a checklist for diagnosing printer problems. It also describes how print errors are logged in the /usr/adm/lperr file, providing this feature is specified in the /etc/printcap file.


11.7.1    Installation and Routine Operations

If a problem occurs on an existing printer or when adding a printer to a system, diagnose the problem as follows:


11.7.2    Printer Error Logging

The lpd daemon logs printer errors to the error log file. Specifying an error log file is optional. If you used lprsetup to install the printer, the program provides the default value /usr/adm/lperr. If you do not specify an error log file, errors are logged to /dev/console.

The error log file is specified with the lf symbol in the /etc/printcap file. For example:

lf=/var/adm/lpderrs

Error log files are usually located in the /var/adm directory. An error log file can be shared by all local printers, but you should specify the file in each /etc/printcap file printer entry.


11.8    TCP/IP (telnet) Printing

TCP/IP printing, also called telnet printing, allows you to submit print jobs to a remote printer that is directly connected to the network. Note that to use this feature, your printer must contain a TCP/IP interface card and must be registered with a TCP/IP node name and node address.

With TCP/IP printing, the local host manages print jobs in the same manner as it would manage print jobs for a local printer. The only difference is that with TCP/IP printing, the local print daemon (lpd) communicates with the remote printer over TCP/IP (similar to LAT printing). Each printer listens for connection requests on a socket number that is specified in the printer hardware or that is user-defined through the printer console.

Although multiple hosts can talk to a single printer connected to the network in this way, the hosts are handled on a first-come, first-served basis. Therefore, TCP/IP printing is not the same as remote printing, in which the remote printer manages a print queue on the remote site and listens for network connections on socket 515 (as specified in the entry for printer in /etc/services).


11.8.1    Setting up TCP/IP Printing

The following steps describe how to set up TCP/IP printing on a local host.

  1. Set up the printer. Assign a TCP/IP address and node name to each printer with a network card. Also, determine the TCP/IP socket number on which the printer will listen for connection requests. You will need the socket number in Step 2b when you edit the /etc/services file. Table 11-10 lists the socket numbers for three printers made by Digital and one made by Hewlett Packard.

    Table 11-10: TCP/IP Socket Numbers
    PrinterSocket Number
    DEClaser 3500 (LN14)  10001 
    DEClaser 5100 (LN09)  10001 
    HP Laserjet 4m+  9100 
    LN17  2501 
    To obtain the socket number for other printers, see your printer documentation. Some printers may allow you to specify this number yourself.

  2. Configure the local host This step describes the utilities that you need to run and the files that you need to modify on the local host in order to configure TCP/IP printing. You must have superuser privileges to perform the following tasks:

    1. Configure the printer using lprsetup Execute the /usr/bin/lprsetup command and answer the questions to create an entry in the /etc/printcap file for your printer. When it prompts you to enter values for printcap control variables, assign the following values to the ct and lp variables:
      ct=tcp
      
      lp=@nodename
      /servicename
      Replace nodename with the name of the printer's node as registered for use on your network and replace servicename with the name you will choose to enter in the /etc/services database in the next step. If you want to modify an existing /etc/printcap printer entry to use TCP/IP printing, edit the /etc/printcap file using a text editor, such as vi, and modify the values for the ct and lp variables. You can also remove the values for the xs, xc, fs, and fc control variables which establish settings that are relevant to the serial port driver. These are ignored by the network socket driver.

    2. Configure the services database. You must register a service name and tcp port number (socket number) in the /etc/services database file. Enter the socket number that you determined when you configured the printer in step 1 and associate it with a service name of your choice. For example, to configure the services database for a DEClaser 3500, you would add the following line to the /etc/services file:
      declaser3500    10001/tcp
      Note that the user-defined declaser3500 string represents the service; it is the same string that you would have entered as the servicename in the /etc/printcap file in step 2a. After saving the changes to the /etc/services file, restart the inetd daemon to reload the /etc/services file with the printer information you just added. To do this, type the following command:
      # rcinet restart
      This stops and restarts the Internet network services on your system.

    3. Configure the remote hosts database. The nodename value that you specified as part of the lp variable value in the /etc/printcap file must be known by your local host's network management services; therefore, you must enter the nodename and its network address in the /etc/hosts database file. If you are running a BIND server for remote host names, you do not necessarily need to add the printer's node name to the /etc/hosts file, though if there is ever a problem with the BIND server, an entry in /etc/hosts would be a useful fallback.


11.8.2    Using TCP/IP Printing

Once configured, TCP/IP printing is used like local and remote printing. From the command line, execute the lpr command specifying the node name of the printer, command options, and file names.


11.8.3    Known Restrictions on the Use of TCP/IP Printing

TCP/IP printing works when printing within a local subnet; however, printing in complex networks across one or more routers may cause reliability problems.

In addition, printing non-PostScript files with some PostScript and non-PostScript filters may yield unexpected results. Table 11-11 lists the filters with which you could experience these problems.

Table 11-11: Non-PostScript and PostScript Filters
Filter NameFilter Type
lpf  Non-PostScript 
la75of  Non-PostScript 
la324of  Non-PostScript 
lqf  Non-PostScript 
hplaserof  PostScript 

To provide expected behavior with older printers, these non-PostScript filters maintain a dependence on the serial port driver to automatically supply carriage returns after line feeds when you specify the (octal) 020 bit to the fs control variable in the /etc/printcap file.

Because this control bit is not interpreted by the network socket driver, the formatting behavior that would be supplied by the serial port driver is absent. Therefore, non-PostScript files that are not preformatted for the printer may not print out as they would in serial-port-connected configurations. In particular, this may affect ASCII text files that do not contain embedded carriage-returns.

Most printers using the lpf, la75of, la324of, and lqf non-PostScript filters do not provide network interface card support. However, the printing problems may still be an issue for users who use serial-and-parallel-port to network-port converters, like the Digital RapidPrint network interface box, which allow these printers to act like TCP/IP printers with built-in network support.

The hplaser4psof PostScript filter works for PostScript files and for preformatted non-Postscript files (like PCL files), but it will likely produce unexpected results for files that have not been preformatted (such as ASCII text without embedded carriage-returns).