/usr/share/doc/lprng-doc/LPRng-Reference-Multipart/x9884.htm is in lprng-doc 3.8.A~rc2-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta name="generator" content=
"HTML Tidy for Linux/x86 (vers 6 November 2007), see www.w3.org">
<title>LPRng accounting.pl Utility</title>
<meta name="GENERATOR" content=
"Modular DocBook HTML Stylesheet Version 1.79">
<link rel="HOME" title=" LPRng Reference Manual" href=
"index.htm">
<link rel="UP" title="Accounting " href="accountingref.htm">
<link rel="PREVIOUS" title="Reliable Accounting" href=
"x9869.htm">
<link rel="NEXT" title="RFC 1179 - Line Printer Daemon Protocol "
href="rfc1179ref.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 Reference Manual: 24
Sep 2004 (For LPRng-3.8.28)</th>
</tr>
<tr>
<td width="10%" align="left" valign="bottom"><a href=
"x9869.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=
"rfc1179ref.htm" accesskey="N">Next</a></td>
</tr>
</table>
<hr align="left" width="100%">
</div>
<div class="SECT1">
<h1 class="SECT1"><a name="AEN9884" id="AEN9884">18.7.
<b class="APPLICATION">LPRng</b> accounting.pl Utility</a></h1>
<p>The <b class="APPLICATION">LPRng</b> <tt class=
"FILENAME">accounting.pl</tt> utility provides the basic
framework for using the <tt class="LITERAL">:as=|</tt>,
<tt class="LITERAL">:ae=|</tt>, and pagecounter information
written to the accounting file to do reliable accounting, and
may be found in the <b class="APPLICATION">LPRng</b>
distribution <tt class="LITERAL">UTILS</tt> directory. Usually
this is modified according to local site needs and installed in
the filter directory.</p>
<p>The utility maintains the accounting file by inserting a
<tt class="LITERAL">START</tt> record at the start of a job and
an <tt class="LITERAL">END</tt> record at the end of the job.
It is assumed that the last <tt class="LITERAL">END</tt> record
in the file marks the last place that accounting was
completed.</p>
<p>The following shows the printcap entry for using the
<tt class="LITERAL">accounting.pl</tt> utility. The <tt class=
"LITERAL">start</tt> and <tt class="LITERAL">end</tt> options
are used to specify that the utility is being called at the job
start or end.</p>
<div class="INFORMALEXAMPLE">
<a name="AEN9902" id="AEN9902"></a>
<pre class="SCREEN">
printer
:af=acct
:as=|/usr/local/libexec/filters/accounting.pl start
:ae=|/usr/local/libexec/filters/accounting.pl end
</pre>
</div>
<p>At the start of each job the utilty writes a <tt class=
"LITERAL">START</tt> record into the accounting file. This
record can contain information suitable for use by local site.
The exit code and information written to the utility
<acronym class="ACRONYM">STDOUT</acronym> is used by the
<tt class="LITERAL">lpd</tt> server to determine if the job is
to be printed. This allows job quotas to be implemented in a
simple way by having the <tt class="LITERAL">accounting.pl</tt>
utility query a database with the user quotas and reject the
job if the user's quota is exceeded.</p>
<p>At the end of the job, the utilitity will read the
accounting file and use the recorded information to update the
accounting information. In order to make this reliable, the
following steps are taken.</p>
<ol type="1">
<li>
<p>The accounting file is read and scanned for the last
<tt class="LITERAL">END</tt> record. If there is none, then
the next step starts at the beginning of the accounting
file.</p>
</li>
<li>
<p>The file is scanned for <tt class="LITERAL">START</tt>
lines and <tt class="LITERAL">pagecounter</tt> information
determined at the start of a job.</p>
</li>
<li>
<p>If the last line in the accounting file does not
indicate successful completetion of the job and contain
pagecounting information, then the accounting procedure is
abandoned until the next job completes successfully.</p>
</li>
<li>
<p>If the last line in the accounting file indicates
successful completion, then its pagecounter value is used
as the last page counter value.</p>
</li>
<li>
<p>Job information is updated by finding the start and end
pagecounter values for each job. It is possible that a job
will not have a pagecounter value recorded at its start; in
this case the page usage will be 0, as it did not even get
initialized.</p>
</li>
<li>
<p>After determining the accounting information, the
procedure will then update and databases and the accounting
file. During this update, interrupts should be disabled and
the amount of time taken to update the accounting
information and/or file should be minimized.</p>
</li>
</ol>
<p>Administrators can use this script as a starting point for
more advanced accounting. For example, rather than just
recording the information, at the job start the script can
query either a local database or a remote server to see if the
user has permissions to access the printer. At the end of the
job or when an <acronym class="ACRONYM">END</acronym> line is
written to the accounting file, the local database or remote
accounting server can be updated.</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=
"x9869.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=
"rfc1179ref.htm" accesskey="N">Next</a></td>
</tr>
<tr>
<td width="33%" align="left" valign="top">Reliable
Accounting</td>
<td width="34%" align="center" valign="top"><a href=
"accountingref.htm" accesskey="U">Up</a></td>
<td width="33%" align="right" valign="top">RFC 1179 - Line
Printer Daemon Protocol</td>
</tr>
</table>
</div>
<p align="center"></p>
</body>
</html>
|