LPRng Reference Manual: 5 Sep 2003 (For LPRng-3.8.22)
Prev | Chapter 18. Accounting | Next

# 18.6. Reliable Accounting

In order to do reliable accounting, the printer must be queueried for the current value of the pagecounter at the start and end of jobs and this information stored in the accounting file. The ifhp filter can be configured to obtain the pagecounter values and to record them at the start and end of each part of a print job. We can use the :of filter to read the pagecounter value at the start and end of a job, and have the other file files record information as well. The ifhp filter will record the pagecounter information with the -p option. We need simply take the difference of the starting and ending pagecounter values to find the number of pages used by a job.

        Example:
         lpd generates:
          jobstart  - from the lpd.conf 'as=' option
          jobend    - from the lpd.conf 'ae=' option
            -H   - host name
            -n   - user name
            -P   - printer
            -k   - control file name
            -b   - byte count of job/file
            -t   - current printing time

         ifhp filter generates:
           start/end         - of filter, for entire job
           filestart/fileend - if or other filter, for each file
           (options above are same)
            -A  - identifier information
            -q  - process id of filter
            -p  - current value of page counter, 0 indicates no
                  page counter on printer or it is not readable

        jobstart '-Hh110.private' '-nroot' '-Plp' \
           '-kcfA129h110.private' '-b48780' '-t2001-10-19-09:36:36.000'
                                   ^^^ bytes in file

        start '-q26130' '-p105340' '-t2001-10-19-09:36:38.330' \
                         ^^^^^^^  starting page counter value for job
            '-Aroot@h110+129' '-nroot' '-Plp'
        filestart '-q26132' '-p105340' '-t2001-10-19-09:36:38.350' \
                              ^^^^^^^  starting page counter value for file
            '-Aroot@h110+129' '-nroot' '-Plp'
        fileend '-b19' '-T435' '-q26132' '-p105359' '-t2001-10-19-09:43:51.504'
                                          ^^^^^^^  ending page countvalue for file
                 ^^^ number of pages printed for this file
            '-Aroot@h110+129' '-nroot' '-Plp'
        end '-b19' '-T435' '-q26130' '-p105359' '-t2001-10-19-09:43:51.504'
                                          ^^^^^^^  ending page countvalue for job
             ^^^ number of pages printed for this job
            '-Aroot@h110+129' '-nroot' '-Plp'
        jobend '-Hh110.private' '-nroot' '-Plp' \
            '-kcfA129h110.private' '-b48780' '-t2001-10-19-09:43:51.000'
                                   ^^^ bytes in file

If for some reason the job is killed or terminates due to error conditions, the :of filter may not get to record the ending value for the job. This can lead to accounting files with the following entries:

        start '-p100' '-q20005' '-Fo' '-kcfA100taco' '-uuser' '-hhost' '-R...
        filestart '-p101' '-q20005' '-Ff' '-kcfA100taco' '-uuser' '-hhost' '-R...
        start '-p110' '-q20005' '-Fo' '-kcfA101taco' '-uuser' '-hhost' '-R...
        filestart '-p112' '-q20010' '-Fo' '-kcfA101taco' '-uuser' '-hhost' '-R...
        end '-p112' '-q20010' '-Fo' '-kcfA101taco' '-uuser' '-hhost' '-R...

The missing end is a clear indication that the user's job has been terminated. We simply use the pagecounter value determined at the start of the next job to find the numbers of pages used for this job.

Prev | Home | Next
Accessing Printer Hardware Pagecounters | Up | LPRng accounting.pl Utility