1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
|
.\" Copyright (c) 1983, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by the University of
.\" California, Berkeley and its contributors.
.\" 4. Neither the name of the University nor the names of its contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" @(#)lpc.8 8.5 (Berkeley) 4/28/95
.\" $FreeBSD$
.\"
.Dd July 16, 2002
.Dt LPC 8
.Os
.Sh NAME
.Nm lpc
.Nd line printer control program
.Sh SYNOPSIS
.Nm
.Op Ar command Op Ar argument ...
.Sh DESCRIPTION
The
.Nm
utility is used by the system administrator to control the
operation of the line printer system.
For each line printer configured in
.Pa /etc/printcap ,
.Nm
may be used to:
.Bl -bullet -offset indent
.It
disable or enable a printer,
.It
disable or enable a printer's spooling queue,
.It
rearrange the order of jobs in a spooling queue,
.It
find the status of printers, and their associated
spooling queues and printer daemons,
.It
change the status message for printer queues (the status message
may be seen by users as part of the output of the
.Xr lpq 1
utility).
.El
.Pp
Without any arguments,
.Nm
will prompt for commands from the standard input.
If arguments are supplied,
.Nm
interprets the first argument as a command and the remaining
arguments as parameters to the command.
The standard input
may be redirected causing
.Nm
to read commands from file.
Commands may be abbreviated;
the following is the list of recognized commands.
.Pp
.Bl -tag -width indent -compact
.It Ic \&? Op Ar command ...
.It Ic help Op Ar command ...
Print a short description of each command specified in the argument list,
or, if no argument is given, a list of the recognized commands.
.Pp
.It Ic abort Brq Cm all | Ar printer
Terminate an active spooling daemon on the local host immediately and
then disable printing (preventing new daemons from being started by
.Xr lpr 1 )
for the specified printers.
.Pp
.It Ic bottomq Ar printer Op Ar jobspec ...
Take the specified jobs in the order specified and move them to the
bottom of the printer queue.
Each
.Ar jobspec
can match multiple print jobs.
The full description of a
.Ar jobspec
is given below.
.Pp
.It Ic clean Brq Cm all | Ar printer
Remove any temporary files, data files, and control files that cannot
be printed (i.e., do not form a complete printer job)
from the specified printer queue(s) on the local machine.
This command will also look for
.Pa core
files in spool directory
for each printer queue, and list any that are found.
It will not remove any
.Pa core
files.
See also the
.Ic tclean
command.
.Pp
.It Ic disable Brq Cm all | Ar printer
Turn the specified printer queues off.
This prevents new
printer jobs from being entered into the queue by
.Xr lpr 1 .
.Pp
.It Ic down Bro Cm all | Ar printer ... Brc Cm -msg Ar message ...
.It Ic down Bro Cm all | Ar printer Brc Ar message ...
Turn the specified printer queue off, disable printing and put
.Ar message
in the printer status file.
When specifying more than one printer queue, the
.Ic -msg
argument is required to separate the list of printers from the text
that will be the new status message.
The message does not need to be quoted, the
remaining arguments are treated like
.Xr echo 1 .
This is normally used to take a printer down, and let other users
find out why it is down (the
.Xr lpq 1
utility will indicate that the printer is down and will print the
status message).
.Pp
.It Ic enable Brq Cm all | Ar printer
Enable spooling on the local queue for the listed printers.
This will allow
.Xr lpr 1
to put new jobs in the spool queue.
.Pp
.It Ic exit
.It Ic quit
Exit from
.Nm .
.Pp
.It Ic restart Brq Cm all | Ar printer
Attempt to start a new printer daemon.
This is useful when some abnormal condition causes the daemon to
die unexpectedly, leaving jobs in the queue.
.Xr lpq 1
will report that there is no daemon present when this condition occurs.
If the user is the super-user,
try to abort the current daemon first (i.e., kill and restart a stuck daemon).
.Pp
.It Ic setstatus Bro Cm all | Ar printer Brc Cm -msg Ar message ...
Set the status message for the specified printers.
The
.Ic -msg
argument is required to separate the list of printers from the text
that will be the new status message.
This is normally used to change the status message when the printer
queue is no longer active after printing has been disabled, and you
want to change what users will see in the output of the
.Xr lpq 1
utility.
.Pp
.It Ic start Brq Cm all | Ar printer
Enable printing and start a spooling daemon for the listed printers.
.Pp
.It Ic status Brq Cm all | Ar printer
Display the status of daemons and queues on the local machine.
.Pp
.It Ic stop Brq Cm all | Ar printer
Stop a spooling daemon after the current job completes and disable
printing.
.Pp
.It Ic tclean Brq Cm all | Ar printer
This will do a test-run of the
.Ic clean
command.
All the same checking is done, but the command will only print out
messages saying what a similar
.Ic clean
command would do if the user typed it in.
It will not remove any files.
Note that the
.Ic clean
command is a privileged command, while the
.Ic tclean
command is not restricted.
.Pp
.It Ic topq Ar printer Op Ar jobspec ...
Take the specified jobs in the order specified and move them to the
top of the printer queue.
Each
.Ar jobspec
can match multiple print jobs.
The full description of a
.Ar jobspec
is given below.
.Pp
.It Ic up Brq Cm all | Ar printer
Enable everything and start a new printer daemon.
Undoes the effects of
.Ic down .
.El
.Pp
Commands such as
.Ic topq
and
.Ic bottomq
can take one or more
.Ar jobspec
to specify which jobs the command should operate on.
A
.Ar jobspec
can be:
.Bl -bullet
.It
a single job number, which will match all jobs in the printer's queue
which have the same job number.
Eg:
.Ar 17 ,
.It
a range of job numbers, which will match all jobs with a number between
the starting and ending job numbers, inclusive.
Eg:
.Ar 21-32 ,
.It
a specific userid, which will match all jobs which were sent by that
user.
Eg:
.Ar jones ,
.It
a host name, when prefixed by an `@', which will match all jobs in
the queue which were sent from the given host.
Eg:
.Ar @freebsd.org ,
.It
a job range and a userid, separated by a `:', which will match all jobs
which both match the job range and were sent by the specified user.
Eg:
.Ar jones:17
or
.Ar 21-32:jones ,
.It
a job range and/or a userid, followed by a host name, which will match
all jobs which match all the specified criteria.
Eg:
.Ar jones@freebsd.org
or
.Ar 21-32@freebsd.org
or
.Ar jones:17@freebsd.org .
.El
.Pp
The values for userid and host name can also include pattern-matching
characters, similar to the pattern matching done for filenames in
most command shells.
Note that if you enter a
.Ic topq
or
.Ic bottomq
command as parameters on the initial
.Nm
command, then the shell will expand any pattern-matching characters
that it can (based on what files in finds in the current directory)
before
.Nm
processes the command.
In that case, any parameters which include pattern-matching characters
should be enclosed in quotes, so that the shell will not try to
expand them.
.Sh FILES
.Bl -tag -width /var/spool/*/lockx -compact
.It Pa /etc/printcap
printer description file
.It Pa /var/spool/*
spool directories
.It Pa /var/spool/*/lock
lock file for queue control
.El
.Sh DIAGNOSTICS
.Bl -diag
.It "?Ambiguous command"
abbreviation matches more than one command
.It "?Invalid command"
no match was found
.It "?Privileged command"
you must be a member of group "operator" or root to execute this command
.El
.Sh SEE ALSO
.Xr lpq 1 ,
.Xr lpr 1 ,
.Xr lprm 1 ,
.Xr printcap 5 ,
.Xr chkprintcap 8 ,
.Xr lpd 8
.Sh HISTORY
The
.Nm
utility appeared in
.Bx 4.2 .
|