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