Need per-user accounting system

Jeff White jeff at drexel.UUCP
Thu Apr 14 10:01:01 AEST 1988



  I've written an accounting package for our system here (an 11/780 running
4.2 BSD), but it's such a kludge that I wouldn't want to send it out.  However,
what I do is to basically use the standard unix commands that deal with
accounting data (sa for cpu and disk I/O, ac for connect time, du for disk 
usage), and do a lot of cutting, pasting, and greping to form a raw data file
that another program can read and them prepare a proper report.
  I use the following commands (I'm actually executing them so you can see the
results):

1. CPU and IO:  sa -ml | grep jeff

% jeff       3575     84.15cpu      61266tio       691383k*sec
%			^ 		^
		    cpu minutes    total io

2. Connect time: ac -p | grep jeff

% 	jeff     21.49
% 		   ^
		hours connect time

3. Pages printed: pac -P{printer_name} -s;pac -P{printer_name} | grep jeff

% drexel:jeff               128.00   24   $  6.40
% 
% 			     ^
			pages printed


4. Disk usage: du -s {home_dir}

% 17831	/usr/jeff
% 


   As you can see, all the raw data you need it pretty easy to obtain.  The 
more difficult part is trying to automate the gathering and reformatting of
this data.  The line below gives a sample of 1 line of this raw data.


% jeff Jeff_White 102 cbis 100 /usr/jeff  13707.     31.  114.23  149967  57.20  11.00   0.00    0.00 
% 
  
  Below is the description of each record that the final program uses to print
out the bills: 

/* DATA FORMAT */  May 18, 1984
   (revised July 23, 1984 by Jeff White)

1) login name { c-string }
2) Full name  { c-string; '_' must be converted to blank }
3) UserId     { int }
4) Group name { c-string }
5) GroupId    { Int }
6) Home dir   { c-string }
7) Disk Usage { Int }
8) Billing Days { Int }
9) CPU time   { Real f5.2 }
10) Disk IO    { Int; No. operations }
11) Connect Time { Real f5.2 }
12) Pages - line      { Real f5.2 }
13) Pages - daisy      { Real f5.2 }
14) Pages - laser      { Real f5.2 }


   I don't want to burden you with any unnecessary information, so if you
have an specific questions, feel free to drop me a line.

						Jeff White
						Drexel University - ECE Dept.
						rutgers!bpa!drexel!jeff



More information about the Comp.unix.ultrix mailing list