1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta name="generator" content="HTML Tidy, see www.w3.org">
<title>Reliable Accounting</title>
<meta name="GENERATOR" content=
"Modular DocBook HTML Stylesheet Version 1.71 ">
<link rel="HOME" title=" LPRng-HOWTO" href="index.htm">
<link rel="UP" title="Accounting " href="accountingref.htm">
<link rel="PREVIOUS" title=
"Accessing Printer Hardware Pagecounters" href="x9562.htm">
<link rel="NEXT" title="\LPRng accounting.pl Utility" href=
"x9588.htm">
</head>
<body class="SECT1" bgcolor="#FFFFFF" text="#000000" link=
"#0000FF" vlink="#840084" alink="#0000FF">
<div class="NAVHEADER">
<table summary="Header navigation table" width="100%" border=
"0" cellpadding="0" cellspacing="0">
<tr>
<th colspan="3" align="center">LPRng-HOWTO: 1 Apr 2002
(For LPRng-3.8.10)</th>
</tr>
<tr>
<td width="10%" align="left" valign="bottom"><a href=
"x9562.htm" accesskey="P">Prev</a></td>
<td width="80%" align="center" valign="bottom">Chapter
18. Accounting</td>
<td width="10%" align="right" valign="bottom"><a href=
"x9588.htm" accesskey="N">Next</a></td>
</tr>
</table>
<hr align="LEFT" width="100%">
</div>
<div class="SECT1">
<h1 class="SECT1"><a name="AEN9573">18.6. Reliable
Accounting</a></h1>
<p>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 <b class="APPLICATION">ifhp</b> 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 <tt class="LITERAL">:of</tt> 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 <tt
class="LITERAL">ifhp</tt> filter will record the pagecounter
information with the <tt class="LITERAL">-p</tt> option. We
need simply take the difference of the starting and ending
pagecounter values to find the number of pages used by a
job.</p>
<div class="INFORMALEXAMPLE">
<a name="AEN9580"></a>
<pre class="SCREEN">
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
</pre>
</div>
<br>
<br>
<p>If for some reason the job is killed or terminates due to
error conditions, the <tt class="LITERAL">:of</tt> filter may
not get to record the ending value for the job. This can lead
to accounting files with the following entries:</p>
<div class="INFORMALEXAMPLE">
<a name="AEN9584"></a>
<pre class="SCREEN">
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...
</pre>
</div>
<br>
<br>
<p>The missing <tt class="LITERAL">end</tt> 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.</p>
</div>
<div class="NAVFOOTER">
<hr align="LEFT" width="100%">
<table summary="Footer navigation table" width="100%" border=
"0" cellpadding="0" cellspacing="0">
<tr>
<td width="33%" align="left" valign="top"><a href=
"x9562.htm" accesskey="P">Prev</a></td>
<td width="34%" align="center" valign="top"><a href=
"index.htm" accesskey="H">Home</a></td>
<td width="33%" align="right" valign="top"><a href=
"x9588.htm" accesskey="N">Next</a></td>
</tr>
<tr>
<td width="33%" align="left" valign="top">Accessing
Printer Hardware Pagecounters</td>
<td width="34%" align="center" valign="top"><a href=
"accountingref.htm" accesskey="U">Up</a></td>
<td width="33%" align="right" valign="top">\<b class=
"APPLICATION">LPRng</b> accounting.pl Utility</td>
</tr>
</table>
</div>
</body>
</html>
|