printbill1
Print filter front-end to printbilld
Usage
printbill --type
<foo>
[--printbill_secondary
<bar1>]
[--printbill_printer
<bar2>]
Overview
printbill is the front-end to printbilld(1), the printbill daemon which actually performs billing/accounting/quote generation. It is designed to be called by lprng via the as=blah option in the printcap(5) file. It accepts the standard default command-line options presented to it by lprng, as well as several additional options which modify its behaviour. These parameters are then sent to printbilld(1) via a Unix-domain socket, as a semicolon-delimited list terminated by a newline.
The script attempts to open a connection, and read a version string from the server. If this matches the version number wired into printbill(1), the command-line parameters passed to printbill(1) from lprng are then sent to printbilld(1) via a Unix-domain socket, as a semicolon-delimited list terminated by a newline. printbilld(1) should then perform the specified operation, and return JSUCC (0) or JREMOVE (3) to the printbill(1) script depending on the results of the operation.
The printcap(5) file should have a pair of lines which look like this:
:achk=true
:as=|/usr/sbin/printbill --type foo
foo can be --bill (pre-printing billing), in which case --printbill_secondary <printer> must also be present in the command line, --lazybill for lazy print billing (post-printing billing), --account (no billing, only accounting) or --quote, in which case --printbill_printer <printer> can also be specified (but <printer> can be the same as the print queue itself if you want - you can make it different so you can have a printer called "bill" and a quote-queue called "quote" which quotes for "bill". printbill --type quote calculates the bill and sends an e-mail/winpopup message containing the results back to the user.
If you wish to use --bill, you should have something more like this:
lp|Laser printer (scheduler queue - print to this)
:lp=/dev/null
:achk=true
:as=|/usr/sbin/printbill --type bill --printbill_secondary real
:sd=/var/spool/lpd/lp
real|Laser printer (real queue - you can't print to this)
:lp=/dev/lp0
:achk=true
:as=|/usr/sbin/printbill_printer
:if=.... (if you need an input filter, e.g. PS -> PCL)
:sd=/var/spool/lpd/lp_real
:mx#0
:sh
You could add this too, to generate quotes:
quote|Quote generator for laser printer
:lp=/dev/null
:achk=true
:as=|/usr/sbin/printbill --type quote --printbill_printer lp
:sd=/var/spool/lpd/lp
Please consult printbill(8) for a more detailed description of how this works. Note that printbilld(1) must be running before this print filter will work.
Options
-
--type bill|lazybill|account|quote -
causes printbilld(1) to do different things - refer to printbilld(1) for details.
-
--printbill_secondary <printer> -
specifies the secondary printer if --type is "bill".
-
--printbill_printer <printer> -
specifies the actual printer we are generating quotes for if --type is "quote". If not specified, it defaults to the default settings (naturally).
-
-j <jobnum> -
specifies the job number (automatically sent by lprng).
-
-H hostname -
specifies the hostname where the job originated (automatically sent by lprng).
-
-n <name> -
specifies the username for this job (automatically sent by lprng).
-
-P <printer> -
specifies the name of the print queue (automatically sent by lprng).
-
-k <filename> -
specifies the control file name (automatically sent by lprng).
-
-d <directory> -
specifies the spool directory for this queue (automatically sent by lprng).
Installation
Please see the accompanying README file for installation instructions. Chances are if you're reading this it's correctly installed.