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