> From [EMAIL PROTECTED] Thu Mar 21 14:27:15 2002 > Date: Fri, 22 Mar 2002 08:33:46 +1100 > To: LPRng Mail List <[EMAIL PROTECTED]> > Subject: LPRng: lpq -a and -Pall wierdness > From: [EMAIL PROTECTED] (Craig Small) > > > I'm getting some wierd bug reports about lpq -a and lpq -Pall > > In 3.8.9 it looks like -a behaves itself, so something changed for the > better from 3.8.8., good! > > lpq -Pall only shows local printers, not remote printers (-a shows > both). > Now, for fun, put in a printer called "all" and now you get to see > remote printers not local ones. (OK there probably shouldn';t be a > printer called all but still)
OK OK, I have fixed up the documentation. (see end of posting) Do not use 'all' for a printer name. It is a reserved printer name. You may get status for 'all' the printers in the universe. The Creator will not be happy and will turn your paycheck into a used lottery ticket. :-) > > More info at > http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=138470&repeatmerged=yes > and you can blame Zed Pobre <[EMAIL PROTECTED]> > > I'll do some more debugging to figure out a bit more what is going on. > > - Craig > -- > Craig Small VK2XLZ GnuPG:1C1B D893 1418 2AF4 45EE 95CB C76C E5AC 12CA DFA5 > Eye-Net Consulting http://www.eye-net.com.au/ <[EMAIL PROTECTED]> > MIEEE <[EMAIL PROTECTED]> Debian developer <[EMAIL PROTECTED]> The difference is basically that of 'recursive' versus 'iterative' status. The lpq -a causes the lpq program to get a list of all of the printers, and to one by one request status from the appropriate print server. For example: lp1:lp=pr@host1 lp2:lp=pr@host2 lpq -a would connect to host1 and request status for pr, and then would connect to host2 and request status for pr lpq -Pall is nasty... it connects to a server and requests status for printer all. Now the question is... what server? If force_localhost is set, it uses the server on the localhost. If you have a printcap file, it looks in the printcap file for printer all. all:rh=host1 ^^^^^ use host1 If you have force_localhost set, it STILL uses the local server, so you have to do: all:rh=host1:force_localhost@ ^^^^^ use host1 Now for the fun part... If you do: all:all=pr1,pr2,pr3 The 'all' field is a list of printers you use. Ummm... by the way, if you use lpq -a AND you have an 'all' entry AND it has a :all= field, then this list overrides the default list of printers in the printcap file. (Is your head starting to hurt yet?) Finally, you can do the totally brain damaging: all:all=pr1@host1,pr2@host2,pr3@host3:force_localhost@ Which, of course, queries the different printers on host1, host2, and host3 (I hope, I don't think I have tried this, but it should work... :0). Now, before you start screaming and shrieking, there are reasons for all of this. The all:all=prlist form allows you to have an NIS/LDAP/whatever database, and when you do lpq -a you query the list of printers. Since some databases do not have or have EXTORTIONATE costs to enumerate entries, this makes a lot of sense. ..... OH, I forgot about the RECURSIVE and ITERATIVE stuff. If, on the server, the printer is being forwarded to another RFC1179 printer, THEN by default the server will (recursively) request status from the destination print queue/server. i.e.: lp:force_localhost lp:server:lp=pr4@host4 - for lpd running on localhost lpq -Plp -> gets status from localhost lpd generates local status lpd generates query to pr4@host4 lpd returns this status Now you can suppress this by using: # Purpose: operations allowed to remote host # default remote_support=RMQVC (STRING) lp:server:lp=pr4@host4 - for lpd running on localhost :remote_support=R - can only send jobs to remote printer NEW lpq man page LPQ(1) LPQ(1) NAME lpq - spool queue examination program SYNOPSIS lpq [ -a ] [ -A ] [ -l ] [ -L ] [ -P printer ] [ -s ] [ -t sleeptime ] [ -V ] [ -D debugopt ] [ jobid... ] DESCRIPTION lpq requests a status report from lpd(8) on the specified printers or jobs. lpq invoked without any arguments reports on the printer given by the default printer (see -P option). The short (default) format simply lists the printer, host, and numbers of jobs in the spool queue. When using the long format (-l option), for each job in a spool queue lpq reports the job identifier which is gener- ated from the user's name and originating host, current rank in the queue, the job number (which may be supplied to lprm(1) for removing a specific job), the job descrip- tion information, and the total size in bytes. If there is an error or other problem with the job, this informa- tion may be modified to reflect the problems. In a spool queue, Job ordering is a modified FIFO (First in First Out), modified by the job class and priority information. The following options are available. -A Use authentication specified by the value of the AUTH environment variable. -Ddebugoptions Debugging is controlled using the -D option. This accepts a comma-separated list of debugging set- tings. These settings take one of two forms: facil- ity=value , or value to set an overall default value. -P printer By default, the destination printer is taken from the command line printer value, then the environ- ment variables PRINTER, LPDEST, NPRINTER, NGPRINTER, then first entry in the printcap infor- mation, and and finally the default_printer entry from the configuration file, and then the compile time default. -V Print version information. -a List status for all printers (see PRINTER LISTS below) which have entries for the LPRng client pro- grams in the printcap(5) database. -l Increase verbosity of the long display format. A single -l options selects a short verbose display, LPRng LPRng-3.9.0 1 LPQ(1) LPQ(1) multiple -l options increase the verbosity. -L Use maximum verbosity for the long display format. -s Display a short, single line status summary for each queue and subqueue. -tsleeptime Forces lpq to periodically display the spool queues and then sleep sleeptime seconds between scans of the queue. jobid ... all The options are followed by a list of jobids which are used to select jobs of interest. A jobid can be a user name, a job identifier, a job number, or a glob based pattern which will be applied to the job identifiers. The all keyword will display all jobs and is the default option. 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. ENVIRONMENT By default, the destination printer is taken from the com- mand 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. PRINTER LISTS The -a option is used to by lpq(1) to get status for a list of printers. This list is formed as follows. 1) The printcap file is scanned for printer entries. Only entries with names starting with a letter or digit are recognized as valid queue or printer names. 2) If the special entry all is present, and it has a field :all=pr1@host1,pr2@host2,... then the print- ers pr1, pr2, ... are used as the printer or queue list. 3) If there is no all entry, then the original list of printers found in step 1) is used as the list of printers. The special case of lpq -Pall disables the searching of the printcap database, and simply sends a query to the lpd LPRng LPRng-3.9.0 2 LPQ(1) LPQ(1) server for status of printer all. The lpd(8) server enu- merates the printers in its printcap file, ignoring any all entry, and returns status only for printers which have entries in the lpd(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' EXIT STATUS The following exit values are returned: zero (0) Successful completion. non-zero (!=0) An error occurred. PRINTCAP INFORMATION 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. 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/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 LPRng LPRng-3.9.0 3 LPQ(1) LPQ(1) /var/spool/lpd/QUEUE/status status file SEE ALSO lpd.conf(5), lpc(8), lpd(8), checkpc(8), lpr(1), lprm(1), printcap(5), lpd.perms(5), pr(1). 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 function- ality 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]>. LPRng LPRng-3.9.0 4 ----------------------------------------------------------------------------- YOU MUST BE A LIST MEMBER IN ORDER TO POST TO THE LPRNG MAILING LIST The address you post from MUST be your subscription address If you need help, send email to [EMAIL PROTECTED] (or lprng-requests or lprng-digest-requests) with the word 'help' in the body. For the impatient, to subscribe to a list with name LIST, send mail to [EMAIL PROTECTED] with: | example: subscribe LIST <mailaddr> | subscribe lprng-digest [EMAIL PROTECTED] unsubscribe LIST <mailaddr> | unsubscribe lprng [EMAIL PROTECTED] If you have major problems, send email to [EMAIL PROTECTED] with the word LPRNGLIST in the SUBJECT line. -----------------------------------------------------------------------------
