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