1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-16 10:20:30 +00:00
freebsd/usr.sbin/lpr/lpc/lpc.8
Garance A Drosehn 004c9c5da2 Make 'lpc clean' somewhat safer. Add an 'lpc tclean' command, which allows
one to see what files would be removed *if* an 'lpc clean' is done.  'tclean'
will remove no files, and is therefore not a privileged command.  Also, both
'lpc clean' and 'lpc tclean' will now look for 'core' files in spool directories
(but not remove them).  They also print out an extra line of info when a
datafile to be removed is a symlink (from 'lpr -s'), saying what file it is
a symlink to.

The 'lpc clean' commands also now print out a summary line saying how many
queues were checked, how many files were removed (or "would be" removed, for
tclean), and how much disk space is involved.  For the benefit of those who
have many print queues, 'lpc clean all' will only print out the names of print
queues where some "interesting" files were found, instead of printing out a
header-line for every queue in your printcap file.

Reviewed by:	freebsd-print@bostonradio.org  freebsd-audit@FreeBSD.org
MFC after:	2 weeks
2001-06-25 02:05:03 +00:00

234 lines
6.5 KiB
Groff

.\" 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 June 20, 2001
.Dt LPC 8
.Os BSD 4.2
.Sh NAME
.Nm lpc
.Nd line printer control program
.Sh SYNOPSIS
.Nm
.Op Ar command Op Ar argument ...
.Sh DESCRIPTION
.Nm Lpc
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.
.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 Xo
.Es \&{ \&}
.En Cm all | Ar printer
.Xc
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 clean Xo
.Es \&{ \&}
.En Cm all | Ar printer
.Xc
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 'core' files in spool directory
for each printer queue, and list any that are found.
It will not remove any 'core' files. See also the
.Ic tclean
command.
.Pp
.It Ic disable Xo
.Es \&{ \&}
.En Cm all | Ar printer
.Xc
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 Xo
.Es \&{ \&}
.En Cm all | Ar printer
.Ar message ...
.Xc
Turn the specified printer queue off, disable printing and put
.Ar message
in the printer status file.
The message doesn't need to be quoted, the
remaining arguments are treated like
.Xr echo 1 .
This is normally used to take a printer down and let others know why
.Xr lpq 1
will indicate the printer is down and print the status message).
.Pp
.It Ic enable Xo
.Es \&{ \&}
.En Cm all | Ar printer
.Xc
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 Xo
.Es \&{ \&}
.En Cm all | Ar printer
.Xc
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 start Xo
.Es \&{ \&}
.En Cm all | Ar printer
.Xc
Enable printing and start a spooling daemon for the listed printers.
.Pp
.It Ic status Xo
.Es \&{ \&}
.En Cm all | Ar printer
.Xc
Display the status of daemons and queues on the local machine.
.Pp
.It Ic stop Xo
.Es \&{ \&}
.En Cm all | Ar printer
.Xc
Stop a spooling daemon after the current job completes and disable
printing.
.Pp
.It Ic tclean Xo
.Es \&{ \&}
.En Cm all | Ar printer
.Xc
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 Xo
.Op Ar jobnum ...
.Op Ar user ...
.Xc
Place the jobs in the order listed at the top of the printer queue.
.Pp
.It Ic up Xo
.Es \&{ \&}
.En Cm all | Ar printer
.Xc
Enable everything and start a new printer daemon.
Undoes the effects of
.Ic down .
.El
.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 SEE ALSO
.Xr lpq 1 ,
.Xr lpr 1 ,
.Xr lprm 1 ,
.Xr printcap 5 ,
.Xr lpd 8
.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 HISTORY
The
.Nm
command appeared in
.Bx 4.2 .