xref: /freebsd/usr.sbin/lpr/lpc/lpc.8 (revision 8a7b61203704d362cfbc66c00619f51b24106b55)
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 July 16, 2002
29 .Dt LPC 8
30 .Os
31 .Sh NAME
32 .Nm lpc
33 .Nd line printer control program
34 .Sh SYNOPSIS
35 .Nm
36 .Op Ar command Op Ar argument ...
37 .Sh DESCRIPTION
38 The
39 .Nm
40 utility is used by the system administrator to control the
41 operation of the line printer system.
42 For each line printer configured in
43 .Pa /etc/printcap ,
44 .Nm
45 may be used to:
46 .Bl -bullet -offset indent
47 .It
48 disable or enable a printer,
49 .It
50 disable or enable a printer's spooling queue,
51 .It
52 rearrange the order of jobs in a spooling queue,
53 .It
54 find the status of printers, and their associated
55 spooling queues and printer daemons,
56 .It
57 change the status message for printer queues (the status message
58 may be seen by users as part of the output of the
59 .Xr lpq 1
60 utility).
61 .El
62 .Pp
63 Without any arguments,
64 .Nm
65 will prompt for commands from the standard input.
66 If arguments are supplied,
67 .Nm
68 interprets the first argument as a command and the remaining
69 arguments as parameters to the command.
70 The standard input
71 may be redirected causing
72 .Nm
73 to read commands from file.
74 Commands may be abbreviated;
75 the following is the list of recognized commands.
76 .Pp
77 .Bl -tag -width indent -compact
78 .It Ic \&? Op Ar command ...
79 .It Ic help Op Ar command ...
80 Print a short description of each command specified in the argument list,
81 or, if no argument is given, a list of the recognized commands.
82 .Pp
83 .It Ic abort Brq Cm all | Ar printer
84 Terminate an active spooling daemon on the local host immediately and
85 then disable printing (preventing new daemons from being started by
86 .Xr lpr 1 )
87 for the specified printers.
88 .Pp
89 .It Ic bottomq Ar printer Op Ar jobspec ...
90 Take the specified jobs in the order specified and move them to the
91 bottom of the printer queue.
92 Each
93 .Ar jobspec
94 can match multiple print jobs.
95 The full description of a
96 .Ar jobspec
97 is given below.
98 .Pp
99 .It Ic clean Brq Cm all | Ar printer
100 Remove any temporary files, data files, and control files that cannot
101 be printed (i.e., do not form a complete printer job)
102 from the specified printer queue(s) on the local machine.
103 This command will also look for
104 .Pa core
105 files in spool directory
106 for each printer queue, and list any that are found.
107 It will not remove any
108 .Pa core
109 files.
110 See also the
111 .Ic tclean
112 command.
113 .Pp
114 .It Ic disable Brq Cm all | Ar printer
115 Turn the specified printer queues off.
116 This prevents new
117 printer jobs from being entered into the queue by
118 .Xr lpr 1 .
119 .Pp
120 .It Ic down Bro Cm all | Ar printer ... Brc Cm -msg Ar message ...
121 .It Ic down Bro Cm all | Ar printer Brc Ar message ...
122 Turn the specified printer queue off, disable printing and put
123 .Ar message
124 in the printer status file.
125 When specifying more than one printer queue, the
126 .Ic -msg
127 argument is required to separate the list of printers from the text
128 that will be the new status message.
129 The message does not need to be quoted, the
130 remaining arguments are treated like
131 .Xr echo 1 .
132 This is normally used to take a printer down, and let other users
133 find out why it is down (the
134 .Xr lpq 1
135 utility will indicate that the printer is down and will print the
136 status message).
137 .Pp
138 .It Ic enable Brq Cm all | Ar printer
139 Enable spooling on the local queue for the listed printers.
140 This will allow
141 .Xr lpr 1
142 to put new jobs in the spool queue.
143 .Pp
144 .It Ic exit
145 .It Ic quit
146 Exit from
147 .Nm .
148 .Pp
149 .It Ic restart Brq Cm all | Ar printer
150 Attempt to start a new printer daemon.
151 This is useful when some abnormal condition causes the daemon to
152 die unexpectedly, leaving jobs in the queue.
153 .Xr lpq 1
154 will report that there is no daemon present when this condition occurs.
155 If the user is the super-user,
156 try to abort the current daemon first (i.e., kill and restart a stuck daemon).
157 .Pp
158 .It Ic setstatus Bro Cm all | Ar printer Brc Cm -msg Ar message ...
159 Set the status message for the specified printers.
160 The
161 .Ic -msg
162 argument is required to separate the list of printers from the text
163 that will be the new status message.
164 This is normally used to change the status message when the printer
165 queue is no longer active after printing has been disabled, and you
166 want to change what users will see in the output of the
167 .Xr lpq 1
168 utility.
169 .Pp
170 .It Ic start Brq Cm all | Ar printer
171 Enable printing and start a spooling daemon for the listed printers.
172 .Pp
173 .It Ic status Brq Cm all | Ar printer
174 Display the status of daemons and queues on the local machine.
175 .Pp
176 .It Ic stop Brq Cm all | Ar printer
177 Stop a spooling daemon after the current job completes and disable
178 printing.
179 .Pp
180 .It Ic tclean Brq Cm all | Ar printer
181 This will do a test-run of the
182 .Ic clean
183 command.
184 All the same checking is done, but the command will only print out
185 messages saying what a similar
186 .Ic clean
187 command would do if the user typed it in.
188 It will not remove any files.
189 Note that the
190 .Ic clean
191 command is a privileged command, while the
192 .Ic tclean
193 command is not restricted.
194 .Pp
195 .It Ic topq Ar printer Op Ar jobspec ...
196 Take the specified jobs in the order specified and move them to the
197 top of the printer queue.
198 Each
199 .Ar jobspec
200 can match multiple print jobs.
201 The full description of a
202 .Ar jobspec
203 is given below.
204 .Pp
205 .It Ic up Brq Cm all | Ar printer
206 Enable everything and start a new printer daemon.
207 Undoes the effects of
208 .Ic down .
209 .El
210 .Pp
211 Commands such as
212 .Ic topq
213 and
214 .Ic bottomq
215 can take one or more
216 .Ar jobspec
217 to specify which jobs the command should operate on.
218 A
219 .Ar jobspec
220 can be:
221 .Bl -bullet
222 .It
223 a single job number, which will match all jobs in the printer's queue
224 which have the same job number.
225 Eg:
226 .Ar 17 ,
227 .It
228 a range of job numbers, which will match all jobs with a number between
229 the starting and ending job numbers, inclusive.
230 Eg:
231 .Ar 21-32 ,
232 .It
233 a specific userid, which will match all jobs which were sent by that
234 user.
235 Eg:
236 .Ar jones ,
237 .It
238 a host name, when prefixed by an `@', which will match all jobs in
239 the queue which were sent from the given host.
240 Eg:
241 .Ar @freebsd.org ,
242 .It
243 a job range and a userid, separated by a `:', which will match all jobs
244 which both match the job range and were sent by the specified user.
245 Eg:
246 .Ar jones:17
247 or
248 .Ar 21-32:jones ,
249 .It
250 a job range and/or a userid, followed by a host name, which will match
251 all jobs which match all the specified criteria.
252 Eg:
253 .Ar jones@freebsd.org
254 or
255 .Ar 21-32@freebsd.org
256 or
257 .Ar jones:17@freebsd.org .
258 .El
259 .Pp
260 The values for userid and host name can also include pattern-matching
261 characters, similar to the pattern matching done for filenames in
262 most command shells.
263 Note that if you enter a
264 .Ic topq
265 or
266 .Ic bottomq
267 command as parameters on the initial
268 .Nm
269 command, then the shell will expand any pattern-matching characters
270 that it can (based on what files in finds in the current directory)
271 before
272 .Nm
273 processes the command.
274 In that case, any parameters which include pattern-matching characters
275 should be enclosed in quotes, so that the shell will not try to
276 expand them.
277 .Sh FILES
278 .Bl -tag -width /var/spool/*/lockx -compact
279 .It Pa /etc/printcap
280 printer description file
281 .It Pa /var/spool/*
282 spool directories
283 .It Pa /var/spool/*/lock
284 lock file for queue control
285 .El
286 .Sh DIAGNOSTICS
287 .Bl -diag
288 .It "?Ambiguous command"
289 abbreviation matches more than one command
290 .It "?Invalid command"
291 no match was found
292 .It "?Privileged command"
293 you must be a member of group "operator" or root to execute this command
294 .El
295 .Sh SEE ALSO
296 .Xr lpq 1 ,
297 .Xr lpr 1 ,
298 .Xr lprm 1 ,
299 .Xr printcap 5 ,
300 .Xr chkprintcap 8 ,
301 .Xr lpd 8
302 .Sh HISTORY
303 The
304 .Nm
305 utility appeared in
306 .Bx 4.2 .
307