LPD(8)

NAME
lpd - printer daemon

SYNOPSIS
/usr/lib/lpd [ -l ] [ -L logfile ] [ port# ]

DESCRIPTION

lpd is the line printer daemon (spool area handler). It is usually invoked at boot time from the rc(8) script, making a single pass through the printcap(5) file to find out about the existing printers and printing any files left after a crash. It then accepts requests to print files in a queue, transfer files to a spooling area, display a queue's status, or remove jobs from a queue. In each case, it forks a child process for each request, and continues to listen for subsequent requests.

The Internet port number used to communicate with other processes is usually obtained with getservent(3N), but can be specified with the port# argument.

If a file cannot be opened, an error message is logged using the LOG_LPR facility of syslog(3). lpd will try up to 20 times to reopen a file it expects to be there, after which it proceeds to the next file or job.

OPTIONS

-l  Log valid requests received from the network. This can be useful for debugging purposes.

-L logfile
    Change the file used for writing error conditions to logfile. The default is to report a message using the syslog(3) facility.

OPERATION

  Access Control

Access control is provided by two means. First, all requests must come from one of the machines listed in either the file /etc/hosts.equiv or /etc/hosts.lpd. (This latter file is in hosts.equiv(5) format.) Second, if the rs capability is specified in the printcap entry, lpr(1) requests are only be honored for users with accounts on the printer host.

  Lock File
The lock file in each spool directory is used to prevent multiple daemons from becoming active, and to store information about the daemon process for lpr(1), lpq(1), and lprm(1).

lpd uses flock(2) to provide exclusive access to the lock file and to prevent multiple daemons from becoming active simultaneously. If the daemon should be killed or die unexpectedly, the lock file need not be removed. The lock file is kept in a readable ASCII form and contains two lines. The first is the process id of the daemon and the second is the control file name of the current job being printed. The second line is updated to reflect the current status of lpd for the programs lpq(1) and lprm(1).

  Control Files
After the daemon has successfully set the lock, it scans the directory for files beginning with cf. Lines in each cf file specify files to be printed or non-printing actions to be performed. Each such line begins with a key character that indicates what to do with the remainder of the line.
    J   Job name to print on the burst page.
    C   Classification line on the burst page.
    L   Literal. This line contains identification information from the password file, and causes a burst page to be printed.
    T   Title string for page headings printed by pr(1V).
    H   Hostname of the machine where lpr(1) was invoked.
    P   Person. Login name of the person who invoked lpr(1). This is used to verify ownership by lprm(1).
    M   Send mail to the specified user when the current print job completes.
    f   Formatted File, the name of a file to print that is already formatted.
    l   Like f, but passes control characters along, and does not make page breaks.
    p   Name of a file to print using pr(1V) as a filter.
    t   Troff File. The file contains troff(1) output (cat phototypesetter commands).
    n   Ditroff File. The file contains device independent troff output.
    d   DVI File. The file contains TEX output (DVI format from Stanford).
    g   Graph File. The file contains data produced by plot(3X).
    c   Cifplot File. The file contains data produced by cifplot.
    v   The file contains a raster image.
    r   The file contains text data with FORTRAN carriage control characters.
    1   Troff Font R. The name of a font file to use instead of the default.
    2   Troff Font I. The name of the font file to use instead of the default.
    3   Troff Font B. The name of the font file to use instead of the default.
    4   Troff Font S. The name of the font file to use instead of the default.
    W   Width. Changes the page width (in characters) used by pr(1V) and the text filters.
    I   Indent. Specify the number of characters by which to indent the output.
    U   Unlink. The name of file to remove upon completion of printing.
    N   Filename. The name of the file being printed, or a blank for the standard input (when lpr(1) is invoked in a pipeline).

  Data Files

When a file is spooled for printing, the contents are copied into a data file in the spool directory. Data file names begin with df. When lpr is called with the -s option, the control files contain a symbolic link to the actual file, and no data files are created.

  Minfree File
The file minfree in each spool directory contains the number of kilobytes to leave free so that the line printer queue won't completely fill the disk.

FILES
/etc/printcap
    printer description file
/var/spool/*
    spool directories
/var/spool/*/minfree
    minimum free space to leave
/dev/lp*
    line printer devices
/dev/printer
    socket for local requests
/etc/hosts.equiv
    hosts allowed equivalent host access
/etc/hosts.lpd
    hosts allowed printer access only

SEE ALSO
lpq(1), lpr(1), lprm(1), hosts(5), hosts.equiv(5), printcap(5), lpc(8), pac(8)