The following options are available.
The lpq will report the status of the spool queue (enabled for spooling, disabled for unspooling), and the absence of a server if unspooling is enabled. The lpc(1) command lpc start <printer> may be used to start the server if this is the case.
By default, the destination printer is taken from the command line dest value, then the environment variables PRINTER, LPDEST, NPRINTER, NGPRINTER, then first entry in the printcap information, and and finally the default_printer entry from the configuration file, and then the compile time default.
The -a option is used to by lpq(1) to get status for a list of printers. This list is formed as follows.
The special case of lpq -Pall disables the searching of the printcap database, and simply sends a query to the lpd server for status of printer all. The (8) server enumerates the printers in its printcap file, ignoring any all entry, and returns status only for printers which have entries in the (8) server printcap file.
Finally, the special case lpq -Ppr@host causes lpq(1) to send a status request for printer pr to host host.
Here is a simple set of rules to use:
Client:
pr1:lp=%P@server
pr2:lp=%P@server
- printer pr1 followed by pr2
pr1:lp=%P@server
pr2:lp=%P@server
all:all=pr2,pr1
- printer pr2 followed by pr1 (all overrides)
Client:
pr1:lp=%P@server
pr2:lp=%P@server
Server:
lp:lp=...
lpq -Pall
- status returned only for printer 'lp'
The following exit values are returned:
The printer names and other information is obtained by using a printcap file or some other database. The ${HOME}/.printcap file can be used to specify user level options and configuration information. See printcap(5) for more information.
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/lpd.conf LPRng configuration file
${HOME}/.printcap user printer description file
/etc/printcap printer description file
/etc/lpd.perms permissions
/var/run/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
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.
LPRng is a enhanced printer spooler system with functionality similar to the Berkeley LPR software. The LPRng mailing list is lprng@lprng.com; subscribe by sending mail to lprng-request@lprng.com with the word subscribe in the body. The software is available from ftp://ftp.lprng.com/pub/LPRng.