Mon Jan 25 23:15:18 EST 1988

	This is a little program I whipped up to help me do user cpu usage
accounting.  On the surface, /etc/sa (or /usr/etc/sa if you're on a Sun) does
cpu usage accounting, but it does so much damn processing that I kept finding
myself being frustrated because I couldn't get exactly the statistics I
wanted.  Very un-unix-like, sa is.  Doesn't let the user get at the actual
data to do what he wants with it.

	My answer was to just convert the fields in /usr/adm/acct to ascii and
hack together awk scripts to pull out whatever bits of information I happened
to want that month.  Maybe not very efficient, but easy.  Contained herein is
the program to print the /usr/adm/acct file, a man page, and a sample shell
script that we run out of crontab at 15 minutes past midnight every day.  We
run this on a network of Sun workstations, all of which remote mount a common
/usr/local.  Since root permissions don't apply accross NFS mount points, I
made /usr/local/acct owned by user "acct", and su to that when it comes time
to move the daily summary file there.  You can't just make the whole script
suid acct because it has to remove /usr/adm/acct (aka /private/usr/adm/acct),
which needs root permission.  Isn't NFS fun?

	One last note.  I like to keep each day's stats in a file named for
that day.  Since we run the stats for day X a few minutes into day X+1, I
can't just use date to generate file names, because the names would be off by
one day.  I whipped up yesterday.c to solve this problem.  A nicer solution
(but decidedly feeping creatureism) would be to expand the Sys5 date to accept
a (signed) offset which is added to the current date before going through the
variable output formatting code.

	This was developed on SunOS-3.[02] systems, and hasn't been tested on
any other systems.  I believe the format of /usr/adm/acct is BSD specific, so
it probably won't run on Sys5 machines unmodified.

	This code is public domain.  Do with it what you want, including
selling it for profit if you can find somebody stupid enough to pay money for
it.  All I ask is that you retain this notice with the code, and keep my name
on it.

Roy Smith, System Administrator
Public Health Research Institute
455 First Avenue, New York, NY 10016

UUCP: {allegra,philabs,seismo!cmcl2}!phri!roy
