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