SYNOPSIS

lpc [ -A ] [ -a ] [ -Ddebugopts ] [ -Pprinter ] [ -Sserver ] [ -Uusername ] [ -V ] [ command [ argument ... ] ]

DESCRIPTION

Lpc is used by the system administrator to control the operation of the line printer system. For each line printer configured in /etc/printcap or the printcaps specified in the configuration file /etc/lprng/lpd.conf (see lpd.conf(5)), lpc may be used to:

  • disable or enable a single or all printer,

  • disable or enable a single printer's or all printer's spooling queue,

  • move jobs to the top a queue

  • find the status of printers, and their associated spooling queues and printer daemons,

  • start and stop printer servers for a queue with multiple print servers,

  • hold and release a specific job in a printer queue,

  • redirect printing to another printer,

  • restart a printer job after having solved printer problems and let it print from the beginning,

  • reprint a job

Without any arguments, lpc will prompt for commands from the standard input. If arguments are supplied, lpc interprets the first argument as a command and the remaining arguments as parameters to the command. Permission to use spool queue control commands is determined by the printer permissions file (See FILES).

OPERATION

The operation of each spool queue is controlled by a spoolcontrol file which has a set of keyword options and values. (Other print spoolers have used permissions bits of directories and files for similar purposes). In addition, each job in the spool queue can have a holdfile which contains detailed information on how the spooler is to treat the particular job. The server will update these files with status and other information as the job is processed. The lpc command operates by sending requests to the lpd server process to update the information in these files and to signal server processes that the information has been updated.

OPTIONS

-A

Use authentication specified by the value of the AUTH environment variable.

-a

Alias for -Pall.

-Pprinter

Printer spool queue to operate on. if no name is given, the -P option, the printer selected by the value of the PRINTER environment variable, or the first entry in the printcap file will be used. When all printers are selected, the LPC command will first attempt to find the printcap entry for printer ``all''; the all printcap field value will be a list of printers to control. If there is no printcap entry, then the request is directly forwarded to the default LPD host, which will do a lookup for all of the available printers. By specifying ``all@host'', the user can control all printers on a given host.

-Sserver

Send commands to this server, rather than the one specified by the -Pprinter" or printcap entry. This allows you to use a default printcap entry for authentication information or other setup information, but direct queries to a specific server.

-V

Print program version information

-Uusername

Set the user name for the request. This option is available only to user root or to the userids listed in the allow_user_setting configuration option.

-Ddebugopts

Debugging is controlled using the -D option. This accepts a comma-separated list of debugging settings. These settings take one of two forms: facility=value , or value to set an overall default value. The form -D= will display a list of debugging options.

COMMANDS

The following is the alphabetical list of recognized commands. The jobcontrol or holdfile fields effective are listed as part of the command.

?

Help. Also, any unrecognized input produces a help listing.

active [pr@[host]]

makes a connection to the LPD server for the specified printer. Closes the connection after making it. This is useful for checking to see if a non-LPRng server is active.

abort { all | printer* }

Kill the active job and disables unspooling. The active job will not be deleted from the queue.

Action: kills server process, updates spool control file printing_disabled field.

class {all | printer } (off | classlist | X=globmatch)

Controls the class of jobs currently being printed. The off option removes any class restrictions. The classlist option is a list of classes; for example A,B,C would release classes A, B, and C for printing. The X=globmatch form performs a match against a control file entry starting with the indicated capital letter. For example, J=*form1* would allow jobs which had the string form1 in their job title to be printed.

defaultq

Lists the default queue for the LPC program.

defaults

Lists default values for the configuration information.

debug j all | printer } [string | off ]

Set the debugging string for the specified printer. This is a diagnostic aid and should be used with caution; refer to the reference manual for details of the debugging string format. In general, you can use:

INTEGER - the integer number sets the general debugging level

keyword=value

- sets a debugging variable to a specified value

keyword - sets a debugging flag

Action: updates spool control file debug field.

disable { all | printer }

Disable spooling to the specified spool queues. See enable.

Action: updates spool control file printing_disabled field.

down {all | printer }

Disable both queuing and printing for all printers or the selected printer. See up.

Action: updates spool control file printing_disabled and spooling_disabled fields.

enable { all | printer }

Enable spooling for all printers or the selected printer.

Action: updates spool control file spooling_disabled field.

exit or quit

terminate LPC program

help

Print a short help message.

hold printer { jobid }

Holds the specified printer job (or jobs) in the queue. The job will not be printed even if spooling and printing is enabled. It must be released with the release command. The holdall command or :ah: printcap flag can enable automatic holding of spooled jobs.

Action: updates job holdfile hold field with time that job was held. A 0 value release job for printing.

holdall { all | printer ... }

Turn on automatic job holding of new jobs. New jobs will be marked as held, and held until released with the release command. This will be done until holdall is turned off with the noholdall command. The :ah: printcap flag can enable automatic holding as well.

Action: updates spool control file holdall field.

kill { all | printer ... }

Do an abort command followed by a start command. This is a quick way to kill off a server that has problems. Note that due to race conditions and delays, that the start command may not be effective this action should be monitored to ensure that the job restarts.

client { all | printer ... }

Show the LPRng client configuration and printcap information on the local host. This is an extremely useful diagnostic tool.

lpd [printer@[host]]

determines if LPD daemon process on the print server is running, and gets the PID. This is handy to determine if the LPD daemon was killed or aborted due to abnormal conditions.

lpq printer [options]

Run lpq from inside the lpc program.

lprm printer jobid [jobid]*

Run lprm from inside the lpc program. Not all options are supported - this form requires the printer name and jobid to be specified explicitly.

move printer jobid destinationPrinter

Send the specified jobs to the destination printer and remove them from the printer queue.

Action: updates the job holdfile move field with the destination and starts a server process to do the job transfer.

msg printer message text

Update the status message for the printer. An empty message will remove the status message.

noholdall { all | printer* }

Turn off automatic job holding. See holdall command.

quit or exit

terminate LPC program

redirect [printer [destinationPrinter | off ]]

redirect the jobs in the printer queue to another printer or turn redirection off.

Action: updates spool control file redirect field.

redo [printer [jobid]]

Reprint the selected job.

release [printer [jobid]]

Releases the selected job for printing.

reread [ printer [@host] ]

Sends a request to the LPD server for the printer to reread the configuration and printcap information. This is equivalent to using kill -HUP serverpid, but can be done for servers on remote hosts.

server { all | printer }

Shows the printcap entries for the printer or all printers as the LPD server would use them.

start { all | printer }

Start the printer. This is useful when some abnormal condition causes the server to terminate unexpectedly leaving jobs in the queue. Lpq will report that there is no daemon present when this condition occurs.

status { all | printer }

Display the status of daemons and queues on the local machine.

stop { all | printer }

Disable any further unspooling after the current job completes.

topq printer [ jobid ]

Place the selected jobs at the top of the printer queue.

up {all | printer ...}

Enables queuing and printing for the specified or all printers. Privileged.

JOBIDS

The LPQ command displays a job identifier for each job, which can be used in LPC commands to identify a specific job. In the commands descriptions above, the jobid can be a user name, a job number, a job identifier, or a glob pattern. The glob pattern is matched against the job identifier. In command which have an optional jobid, if none is specified then the first printable job in the queue is acted on.

FILES

The files used by LPRng are set by values in the printer configuration file. The following are a commonly used set of default values.

/etc/lprng/lpd.conf	LPRng configuration file
${HOME}/.printcap	user printer description file
/etc/printcap	printer description file
/etc/lprng/lpd.perms	permissions
/var/run/lprng/lpd	lock file for queue control
/var/spool/lpd		spool directories
/var/spool/lpd/QUEUE/control	queue control
/var/spool/lpd/QUEUE/log	trace or debug log file
/var/spool/lpd/QUEUE/acct	accounting file
/var/spool/lpd/QUEUE/status	status file

RELATED TO lpc…

DIAGNOSTICS

Most of the diagnostics are self explanatory.
If you are puzzled over the exact cause of failure,
set the debugging level on (-D5) and run again.
The debugging information will
help you to pinpoint the exact cause of failure.

HISTORY

LPRng is a enhanced printer spooler system with functionality similar to the Berkeley LPR software. The LPRng mailing list is [email protected]; subscribe by sending mail to [email protected] with the word subscribe in the body. The software is available from ftp://ftp.lprng.com/pub/LPRng.

AUTHOR

Patrick Powell <[email protected]>.