xref: /freebsd/usr.sbin/lpr/lpd/lpd.8 (revision fd45b686f9d92f583366c75b22c04c7ee49709c0)
1.\" Copyright (c) 1983, 1991, 1993
2.\"	The Regents of the University of California.  All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\"    notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\"    notice, this list of conditions and the following disclaimer in the
11.\"    documentation and/or other materials provided with the distribution.
12.\" 3. Neither the name of the University nor the names of its contributors
13.\"    may be used to endorse or promote products derived from this software
14.\"    without specific prior written permission.
15.\"
16.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26.\" SUCH DAMAGE.
27.\"
28.Dd April 15, 2021
29.Dt LPD 8
30.Os
31.Sh NAME
32.Nm lpd
33.Nd line printer spooler daemon
34.Sh SYNOPSIS
35.Nm
36.Op Fl cdlpsFW46
37.Op Ar port#
38.Sh DESCRIPTION
39The
40.Nm
41utility
42is the line printer daemon (spool area handler) and is normally invoked
43at boot time from the
44.Xr rc 8
45file.
46It makes a single pass through the
47.Xr printcap 5
48file to find out about the existing printers and
49prints any files left after a crash.
50It then uses the system calls
51.Xr listen 2
52and
53.Xr accept 2
54to receive requests to print files in the queue,
55transfer files to the spooling area, display the queue,
56or remove jobs from the queue.
57In each case, it forks a child to handle
58the request so the parent can continue to listen for more requests.
59.Pp
60Available options:
61.Bl -tag -width Ds
62.It Fl c
63By default, if some remote host has a connection error while trying to
64send a print request to
65.Nm
66on a local host,
67.Nm
68will only send error message to that remote host.
69The
70.Fl c
71flag causes
72.Nm
73to also log all of those connection errors via
74.Xr syslog 3 .
75.It Fl d
76Turn on
77.Dv SO_DEBUG
78on the Internet listening socket (see
79.Xr setsockopt 2 ) .
80.It Fl l
81The
82.Fl l
83flag causes
84.Nm
85to log valid requests received from the network.
86This can be useful
87for debugging purposes.
88.It Fl p
89The
90.Fl p
91flag is a synonym for the
92.Fl s
93flag.
94It is being deprecated, and may be removed in a
95future version of
96.Nm .
97.It Fl s
98The
99.Fl s
100(secure) flag causes
101.Nm
102not to open an Internet listening socket.
103This means that
104.Nm
105will not accept any connections from any remote
106hosts, although it will still accept print requests
107from all local users.
108.It Fl F
109By default,
110.Nm
111will daemonize into the background.
112The
113.Fl F
114flag causes
115.Nm
116to remain in the foreground.
117Logging is still performed with
118.Xr syslog 3 .
119.It Fl W
120By default, the
121.Nm
122daemon will only accept connections which originate
123from a reserved-port (<1024) on the remote host.
124The
125.Fl W
126flag causes
127.Nm
128to accept connections coming from any port.
129This is can be useful when you want to accept print jobs
130from certain implementations of lpr written for Windows.
131.It Fl 4
132Inet only.
133.It Fl 6
134Inet6 only.
135.It Fl 46
136Inet and inet6 (default).
137.It Ar "port#"
138The Internet port number used to rendezvous
139with other processes is normally obtained with
140.Xr getservbyname 3
141but can be changed with the
142.Ar port#
143argument.
144.El
145.Pp
146Access control is provided by two means.
147First, all requests must come from
148one of the machines listed in the file
149.Pa /etc/hosts.equiv
150or
151.Pa /etc/hosts.lpd .
152Second, if the
153.Li rs
154capability is specified in the
155.Xr printcap 5
156entry for the printer being accessed,
157.Em lpr
158requests will only be honored for those users with accounts on the
159machine with the printer.
160.Pp
161The file
162.Em minfree
163in each spool directory contains the number of kilobytes to leave free
164so that the line printer queue will not completely fill the disk.
165The
166.Em minfree
167file can be edited with your favorite text editor.
168.Pp
169The daemon begins processing files
170after it has successfully set the lock for exclusive
171access (described a bit later),
172and scans the spool directory
173for files beginning with
174.Em cf .
175Lines in each
176.Em cf
177file specify files to be printed or non-printing actions to be
178performed.
179Each such line begins with a key character
180to specify what to do with the remainder of the line.
181.Bl -tag -width Ds
182.It J
183Job Name.
184String to be used for the job name on the burst page.
185.It C
186Classification.
187String to be used for the classification line
188on the burst page.
189.It L
190Literal.
191The line contains identification info from
192the password file and causes the banner page to be printed.
193.It T
194Title.
195String to be used as the title for
196.Xr pr 1 .
197.It H
198Host Name.
199Name of the machine where
200.Xr lpr 1
201was invoked.
202.It P
203Person.
204Login name of the person who invoked
205.Xr lpr 1 .
206This is used to verify ownership by
207.Xr lprm 1 .
208.It M
209Send mail to the specified user when the current print job completes.
210.It f
211Formatted File.
212Name of a file to print which is already formatted.
213.It l
214Like ``f'' but passes control characters and does not make page breaks.
215.It p
216Name of a file to print using
217.Xr pr 1
218as a filter.
219.It t
220Troff File.
221The file contains
222.Xr troff 1 Pq Pa ports/textproc/groff
223output (cat phototypesetter commands).
224.It n
225Ditroff File.
226The file contains device independent troff
227output.
228.It r
229DVI File.
230The file contains
231.Tn Tex l
232output
233DVI format from Stanford.
234.It g
235Graph File.
236The file contains data produced by
237.Xr plot 3 .
238.It c
239Cifplot File.
240The file contains data produced by
241.Em cifplot .
242.It v
243The file contains a raster image.
244.It r
245The file contains text data with
246FORTRAN carriage control characters.
247.It \&1
248Troff Font R.
249Name of the font file to use instead of the default.
250.It \&2
251Troff Font I.
252Name of the font file to use instead of the default.
253.It \&3
254Troff Font B.
255Name of the font file to use instead of the default.
256.It \&4
257Troff Font S.
258Name of the font file to use instead of the default.
259.It W
260Width.
261Changes the page width (in characters) used by
262.Xr pr 1
263and the text filters.
264.It I
265Indent.
266The number of characters to indent the output by (in ASCII).
267.It U
268Unlink.
269Name of file to remove upon completion of printing.
270.It N
271File name.
272The name of the file which is being printed, or a blank
273for the standard input (when
274.Xr lpr 1
275is invoked in a pipeline).
276.It Z
277Locale.
278String to be used as the locale for
279.Xr pr 1 .
280.El
281.Pp
282If a file cannot be opened, a message will be logged via
283.Xr syslog 3
284using the
285.Em LOG_LPR
286facility.
287The
288.Nm
289utility will try up to 20 times
290to reopen a file it expects to be there, after which it will
291skip the file to be printed.
292.Pp
293The
294.Nm
295utility uses
296.Xr flock 2
297to provide exclusive access to the lock file and to prevent multiple
298daemons from becoming active simultaneously.
299If the daemon should be killed
300or die unexpectedly, the lock file need not be removed.
301The lock file is kept in a readable
302.Tn ASCII
303form
304and contains two lines.
305The first is the process id of the daemon and the second is the control
306file name of the current job being printed.
307The second line is updated to
308reflect the current status of
309.Nm
310for the programs
311.Xr lpq 1
312and
313.Xr lprm 1 .
314.Sh FILES
315.Bl -tag -width "/var/spool/*/minfree" -compact
316.It Pa /etc/printcap
317printer description file
318.It Pa /var/spool/*
319spool directories
320.It Pa /var/spool/*/minfree
321minimum free space to leave
322.It Pa /dev/lp*
323line printer devices
324.It Pa /var/run/printer
325socket for local requests
326.It Pa /etc/hosts.equiv
327lists machine names allowed printer access
328.It Pa /etc/hosts.lpd
329lists machine names allowed printer access,
330but not under same administrative control.
331.El
332.Sh SEE ALSO
333.Xr lpq 1 ,
334.Xr lpr 1 ,
335.Xr lprm 1 ,
336.Xr setsockopt 2 ,
337.Xr syslog 3 ,
338.Xr hosts.lpd 5 ,
339.Xr printcap 5 ,
340.Xr chkprintcap 8 ,
341.Xr lpc 8 ,
342.Xr pac 8
343.Rs
344.\" 4.4BSD SMM:7
345.%A Ralph Campbell
346.%T "4.2 BSD Line Printer Spooler Manual"
347.Re
348.Sh HISTORY
349An
350.Nm
351daemon appeared in Version 6 AT&T UNIX.
352