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