Printer accounting summary

From: Kjell Eidem (eidem@itk.unit.no)
Date: Mon Dec 16 1991 - 10:30:17 CST


A few days ago I sent this about doing printer accounting in
SunOS 4.1.1:

> We are looking for info about doing printer accounting in a Sparc
> environment with SunOS 4.1.1. We want to keep tabs of how much printing
> is done ore even charge for printer usage.
> I know about the af variable in /etc/printcap and the pac command, but
> unfortunately the lpd daemon does not log any information in the
> af file as it would do in a BSD system.
> So if there are some tools, progs etc. available somwhere, preferably
> public domain, let me know about it.

Here is a summary of the responses from the net.
Thanks to everyone who replied.

Kjell Eidem <eidem@itk.unit.no>

-------------------------------------------------------------------
From: lemke@MITL.COM (Kennedy Lemke)

The SunOS 4.1.1 version of the Berkeley lpr suite certainly does
exist. If you are not getting stuff written to the accounting
file, you should first try killing and restarting lpd (or do
this via lpc). If that doesn't do the trick, then make sure
that the entire directory path of the accounting file exists,
and that the file itself is writeable by group daemon.

If all of this fails, try doing a trace(1) on lpd (the one that
is started up for the specific job) and it should tell you
what the problem is.

--------------------------------------------------------------------
From: Paul A. Scowen <uk1@spacsun.rice.edu>

This I don't understand. We're doing just just what you say cannot be done,
with all print jobs being logged into the af specified in the printcap -
or are you using another machine as your print server? Then you won't g get
any logged stuff because all the jobs will be transmitted to the print server
and logged there.

-----------------------------------------------------------
From: sjh@helicon.math.purdue.edu

I use a package called lpa which I believe was developed locally. I
think prm@ecn.purdue.edu could probably tell you more. I don't know
if they are willing or able to let it out of the University, though.

--------------------------------------------------------------
From: Mike Raffety <miker@sbcoc.com>

The lpd daemon doesn't ever do any accounting; your input filter
needs to accept an argument naming the log file (which lpd will
pass to it). lpd calls the filters like this:

 * Set up the chain [ PR [ | {IF, OF} ] ] or {IF, RF, TF, NF, DF, CF, VF}.

The input filter is called with something like:

input_filter -n logname -h fromhost accounting_file

You need an input filter that will do something with that argument
(like append a line with the page count when it gets done).

----------------------------------------------------
From: Jim Mattson <mattson@cs.UCSD.EDU>

We use pac here with SunOS 4.1.1 and have never had any trouble with it.
Does your af file exist on the machine that drives the printer? Lpd won't
create it if it isn't there.

-----------------------------------------------------------
From: Daniel Baldoni <flint@abel.cs.curtin.edu.au>

lpd/lpr by themselves don't do any real accounting. You need to specify
input/output filters which will do the page-counting for you. Here's an
entry we've set up for one of our line-printers:

        lp1|lp|abel line printer:\
                :br#9600:lp=/dev/ttya:of=/usr/lib/lpf:if=/usr/lib/lpf:\
                                      ^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^
                :pc#300:af=/var/adm/lp1.acct:\
                :sd=/usr/spool/printers/lp1:lf=/usr/adm/lpd-errs:

The SUN-supplied /usr/lib/lpf will do the page-counting for you. The
pc#300 field sets the price-per-page to 3 cents. Then your specified
'af' file will contain the number of pages printed, the number of runs
they were printed in, and the total cost.

When I set this up, I could find *NO* documentation on lpf in any of
the manuals (paper or on-line). I just happened across it on an Ultrix
machine and (luckily) it was the same beastie on SunOS (we're running
4.1.1 by the way).

---------------------------------------------------------
From: simon@liasun6.epfl.ch (Simon Leinen)

Here it works fine -- maybe you have a permission problem with the
accounting file?

root@liasun3# ls -l /usr/adm/lw.acct
-rw-r--r-- 1 daemon staff 39350 Dec 11 10:52 /usr/adm/lw.acct

--
--------------------------------------------------------------------
From: "Pedro A.M. Vazquez" <vazquez@iqm.unicamp.ansp.br>

Yes, there is PD pacakge: PLP or public line printer. It does accounting by: user, group, host, etc. But Im using SUnOS 4.1.1 on a 330 server and the pac works ok. Does have check all write permissions on the lpacct file? I've the follow: total 203 drwxr-sr-x 5 bin 512 Oct 13 1990 acct -rw-rw-r-- 1 root 114 Oct 29 01:05 active -rw------- 1 uucp 0 Oct 13 1990 aculog -rw-r--r-- 1 root 699 Dec 11 01:02 dtmp -rw-r--r-- 1 root 0 Nov 10 02:00 fee -rw-r--r-- 1 root 5740 Dec 11 12:15 lastlog -rw-rw-r-- 1 root 9175 Dec 11 11:11 logoutlog -rw-r--r-- 1 daemon 22062 Dec 11 09:26 lp.acct -rw-r--r-- 1 root 67 Oct 12 14:14 lpd-errs -rw-rw-r-- 1 daemon 13347 Dec 11 11:38 lw.acct -rw-r--r-- 1 root 6567 Dec 11 02:00 messages -rw-r--r-- 1 root 51883 Dec 7 02:00 messages.0 -rw-r--r-- 1 root 10568 Nov 30 02:00 messages.1 -rw-r--r-- 1 root 9255 Nov 23 02:00 messages.2 -rw-r--r-- 1 root 10059 Nov 16 02:00 messages.3 -rw-r--r-- 1 root 0 Oct 13 1990 msgbuf -rw-r--r-- 1 root 58656 Dec 11 12:29 pacct

-rw-r--r-- 1 root 58656 Dec 11 12:29 pacct -rw-r--r-- 1 root 0 Oct 13 1990 usracct -rw-r--r-- 1 root 828 Dec 11 12:15 wtmp

What I've noticed is that the NewsPrint package doens't work with both pac & PLP. But I haven't NewsPrint in my site. The problem I've noticed with 4.1.1 and printer control is that th rg (restricted group) doesn't work sometimes.

------------------------------------------------------- From: jpd@pc.usl.edu (Dugal James P.)

Hi! Here at USL we ported the BSD 4.3 lpd package to SunOS 4.1.1B and use it instead of the Sun stuff. We needed to be able to charge to departments and so modified the af for some printers, and also the lpr command. If you are interested in our port, perhaps I could make it available for ftp.

-------------------------------------------------- From: ajs6143@eerpf001.boeing.com ( Andy J. Stefancik (206) 234-3049 )

Need to chown daemon.daemon on you printcap's af logfile. --------------------------------------------------



This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:06:22 CDT