Michael Loßin on Tue, 5 Mar 2002 15:46:29 +0100 (CET)(envelope-from owner-apsfilter-help@apsfilter.org)


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: patch: software page accounting and apsfilter


On 05-Mar-02 Michal Szymanski wrote:
> On Thu, Feb 28, 2002 at 10:22:03PM +0100, Michael Loßin wrote:
>> If you really manage to set up a working software accounting
>> system (I haven't seen one yet), please report it here...
> 
> Below, I include a patch (based on Michael's hints) to apply to
> "apsfilter" in order to get simple software page accounting for a
> PostScript (!) printer. Surely it is not bullet-proof but seems to work
> acceptably fine in an environment (like in my institute) where:

For very loose meanings of "working", this is actually
working... ;^)

> If so, a line is added to printer's accounting file (between jobstart
> and jobend entries):
> 
> jobacct USER HOST QUEUE NO_OF_PAGES DATE HOUR JOBNAME
> 
> e.g.:
> 
> jobacct popielsk fornax.astrouw.edu.pl lw 1 2002/03/05 11:19:45 temp.ps

Is this some kind of standard format? (I doubt it, since
people don't even seem to be able to agree on one time/date
format.)

LPRng mentions this in the HOWTO:

jobstart '-Hh4.private' '-nroot' '-Pps' '-kcfA938h4.private' \
'-b1093' '-tNov  5 19:39:25'
start '-p12942' '-kcfA938h4.private' '-nroot' '-hh4.private' '-Pps' \
'-c0' '-Fo' '-tSun Nov  5 19:39:25 1995'
filestart '-p12944' '-kcfA938h4.private' '-nroot' '-hh4.private' '-Pps' \
'-c0' '-Ff' '-tSun Nov  5 19:39:27 1995'
fileend '-p12944' '-kcfA938h4.private' '-nroot' '-hh4.private' '-Pps' \
'-b3' '-c0' '-Ff' '-tSun Nov  5 19:39:58 1995'
end '-p12942' '-kcfA938h4.private' '-nroot' '-hh4.private' '-Pps' \
'-b2' '-c0' '-Fo' '-tSun Nov  5 19:39:59 1995'
jobend '-Hh4.private' '-nroot' '-Pps' '-kcfA938h4.private' \
'-b1093' '-tNov  5 19:39:59'

Some of which is produced by the "if" filter, some by
the "of" filter -- isn't it nice...

> It would be nice if it could be included in future releases of
> apsfilter, eliminating the need for manual patching the new versions.

Only if we include a big fat warning in the documentation
about software accounting not "really" working... or we
don't mention it at all  :^D


> +    echo jobacct $USER $HOST $QUEUE $cnt `date "+%Y/%m/%d %T"` $JOB \
> +             >> ${ACCT_FILE:-/dev/null}

This assumes that ACCT_FILE is actually a file, not some
kind of network connection (which is legal). LPRng opens
file descriptor 3 to the accounting file, so a line like

        echo jobacct ... >&3

should be correct. How does the BSD-lpd handle that?


Michael