1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 2 3<html> 4 <head> 5 <meta name="generator" content="HTML Tidy, see www.w3.org"> 6 <title>Reliable Accounting</title> 7 <meta name="GENERATOR" content= 8 "Modular DocBook HTML Stylesheet Version 1.7"> 9 <link rel="HOME" title=" LPRng Reference Manual" href= 10 "index.htm"> 11 <link rel="UP" title="Accounting " href="accountingref.htm"> 12 <link rel="PREVIOUS" title= 13 "Accessing Printer Hardware Pagecounters" href="x9761.htm"> 14 <link rel="NEXT" title="LPRng accounting.pl Utility" href= 15 "x9787.htm"> 16 </head> 17 18 <body class="SECT1" bgcolor="#FFFFFF" text="#000000" link= 19 "#0000FF" vlink="#840084" alink="#0000FF"> 20 <div class="NAVHEADER"> 21 <table summary="Header navigation table" width="100%" border= 22 "0" cellpadding="0" cellspacing="0"> 23 <tr> 24 <th colspan="3" align="center">LPRng Reference Manual: 5 25 Sep 2003 (For LPRng-3.8.22)</th> 26 </tr> 27 28 <tr> 29 <td width="10%" align="left" valign="bottom"><a href= 30 "x9761.htm" accesskey="P">Prev</a></td> 31 32 <td width="80%" align="center" valign="bottom">Chapter 33 18. Accounting</td> 34 35 <td width="10%" align="right" valign="bottom"><a href= 36 "x9787.htm" accesskey="N">Next</a></td> 37 </tr> 38 </table> 39 <hr align="LEFT" width="100%"> 40 </div> 41 42 <div class="SECT1"> 43 <h1 class="SECT1"><a name="AEN9772">18.6. Reliable 44 Accounting</a></h1> 45 46 <p>In order to do reliable accounting, the printer must be 47 queueried for the current value of the pagecounter at the 48 start and end of jobs and this information stored in the 49 accounting file. The <b class="APPLICATION">ifhp</b> filter 50 can be configured to obtain the pagecounter values and to 51 record them at the start and end of each part of a print job. 52 We can use the <var class="LITERAL">:of</var> filter to read 53 the pagecounter value at the start and end of a job, and have 54 the other file files record information as well. The <var 55 class="LITERAL">ifhp</var> filter will record the pagecounter 56 information with the <var class="LITERAL">-p</var> option. We 57 need simply take the difference of the starting and ending 58 pagecounter values to find the number of pages used by a 59 job.</p> 60 61 <div class="INFORMALEXAMPLE"> 62 <a name="AEN9779"></a> 63<pre class="SCREEN"> 64 Example: 65 lpd generates: 66 jobstart - from the lpd.conf 'as=' option 67 jobend - from the lpd.conf 'ae=' option 68 -H - host name 69 -n - user name 70 -P - printer 71 -k - control file name 72 -b - byte count of job/file 73 -t - current printing time 74 75 ifhp filter generates: 76 start/end - of filter, for entire job 77 filestart/fileend - if or other filter, for each file 78 (options above are same) 79 -A - identifier information 80 -q - process id of filter 81 -p - current value of page counter, 0 indicates no 82 page counter on printer or it is not readable 83 84 jobstart '-Hh110.private' '-nroot' '-Plp' \ 85 '-kcfA129h110.private' '-b48780' '-t2001-10-19-09:36:36.000' 86 ^^^ bytes in file 87 88 start '-q26130' '-p105340' '-t2001-10-19-09:36:38.330' \ 89 ^^^^^^^ starting page counter value for job 90 '-Aroot@h110+129' '-nroot' '-Plp' 91 filestart '-q26132' '-p105340' '-t2001-10-19-09:36:38.350' \ 92 ^^^^^^^ starting page counter value for file 93 '-Aroot@h110+129' '-nroot' '-Plp' 94 fileend '-b19' '-T435' '-q26132' '-p105359' '-t2001-10-19-09:43:51.504' 95 ^^^^^^^ ending page countvalue for file 96 ^^^ number of pages printed for this file 97 '-Aroot@h110+129' '-nroot' '-Plp' 98 end '-b19' '-T435' '-q26130' '-p105359' '-t2001-10-19-09:43:51.504' 99 ^^^^^^^ ending page countvalue for job 100 ^^^ number of pages printed for this job 101 '-Aroot@h110+129' '-nroot' '-Plp' 102 jobend '-Hh110.private' '-nroot' '-Plp' \ 103 '-kcfA129h110.private' '-b48780' '-t2001-10-19-09:43:51.000' 104 ^^^ bytes in file 105</pre> 106 </div> 107 <br> 108 <br> 109 110 <p>If for some reason the job is killed or terminates due to 111 error conditions, the <var class="LITERAL">:of</var> filter 112 may not get to record the ending value for the job. This can 113 lead to accounting files with the following entries:</p> 114 115 <div class="INFORMALEXAMPLE"> 116 <a name="AEN9783"></a> 117<pre class="SCREEN"> 118 start '-p100' '-q20005' '-Fo' '-kcfA100taco' '-uuser' '-hhost' '-R... 119 filestart '-p101' '-q20005' '-Ff' '-kcfA100taco' '-uuser' '-hhost' '-R... 120 start '-p110' '-q20005' '-Fo' '-kcfA101taco' '-uuser' '-hhost' '-R... 121 filestart '-p112' '-q20010' '-Fo' '-kcfA101taco' '-uuser' '-hhost' '-R... 122 end '-p112' '-q20010' '-Fo' '-kcfA101taco' '-uuser' '-hhost' '-R... 123</pre> 124 </div> 125 <br> 126 <br> 127 128 <p>The missing <var class="LITERAL">end</var> is a clear 129 indication that the user's job has been terminated. We simply 130 use the pagecounter value determined at the start of the next 131 job to find the numbers of pages used for this job.</p> 132 </div> 133 134 <div class="NAVFOOTER"> 135 <hr align="LEFT" width="100%"> 136 137 <table summary="Footer navigation table" width="100%" border= 138 "0" cellpadding="0" cellspacing="0"> 139 <tr> 140 <td width="33%" align="left" valign="top"><a href= 141 "x9761.htm" accesskey="P">Prev</a></td> 142 143 <td width="34%" align="center" valign="top"><a href= 144 "index.htm" accesskey="H">Home</a></td> 145 146 <td width="33%" align="right" valign="top"><a href= 147 "x9787.htm" accesskey="N">Next</a></td> 148 </tr> 149 150 <tr> 151 <td width="33%" align="left" valign="top">Accessing 152 Printer Hardware Pagecounters</td> 153 154 <td width="34%" align="center" valign="top"><a href= 155 "accountingref.htm" accesskey="U">Up</a></td> 156 157 <td width="33%" align="right" valign="top"><b class= 158 "APPLICATION">LPRng</b> accounting.pl Utility</td> 159 </tr> 160 </table> 161 </div> 162 </body> 163</html> 164 165