| Article Index |
|---|
| info accounting |
| Page 2 |
| All Pages |
Page 1 of 2
This is Info file accounting.info, produced by Makeinfo version 1.67from the input file accounting.texi.
GNU Accounting Utilities Copyright (C) 1993, 1996, 1997 Free
Software Foundation, Inc.
Permission is granted to make and distribute verbatim copies of this
manual provided the copyright notice and this permission notice are
preserved on all copies.
Permission is granted to copy and distribute modified versions of
this manual under the conditions for verbatim copying, provided that the
entire resulting derived work is distributed under the terms of a
permission notice identical to this one.
Permission is granted to copy and distribute translations of this
manual into another language, under the above conditions for modified
versions, except that this permission notice may be stated in a
translation approved by the Foundation.
File: accounting.info, Node: Top, Next: Preface, Prev: (dir), Up: (dir)
Welcome to the GNU Accounting Utilities! If you don't have a clue
about the accounting utilities, read the introduction. For specfic
information about any of the applications, see the chapter with the
program's name.
This is Edition 6.3.2 of the documentation, updated 10 March 1998
for version 6.3.2 of the GNU Accounting Utilities.
* Menu:
* Preface:: general information about the accounting utilities
* ac:: print statistics about connect time
* accton:: turns accounting on or off
* last:: list last logins of users and terms
* lastcomm:: list last commands executed
* sa:: print accounting statistics
File: accounting.info, Node: Preface, Next: ac, Prev: Top, Up: Top
Preface
*******
Way back a long time ago, Thompson and Ritchie were sitting opposite
one another at the commissary, sipping coffees and discussing their
evolving behemoth.
"This behemoth of ours," said Ken, "is becoming rather popular,
wouldn't you say?" "Yes," said Dennis. "Every time I want to do a
compilation, I have to wait for hours and hours. It's infuriating."
They both agreed that the load on their system was too great. Both
sighed, picked up their mugs, and went back to the workbench. Little
did they know that an upper-management type was sitting just within
earshot of their conversation.
"We are AT&T Bell Laboratories, aren't we?" the upper-management type
thought to himself. "Well, what is our organization best known for?"
The brill-cream in his hair glistened. "Screwing people out of lots of
money, of course! If there were some way that we could keep tabs on
users and charge them through the nose for their CPU time..."
The accounting utilities were born.
Seriously though, the accouting utilities can provide a system
administrator with useful information about system usage--connections,
programs executed, and utilization of system resources.
Information about users--their connect time, location, programs
executed, and the like--is automatically recored in files by `init' and
`login'. Four of them are of interest to us: `wtmp', which has records
for each login and logout; `acct', which records each command that was
run; `usracct' and `savacct', which contain summaries of the
information in `acct' by user and command, respectively. Each of the
accounting utilities reports or summarizes information stored in these
files.
`ac'
prints statistics about users' connect time. `ac' can tell you how
long a particular user or group of users were connected to your
system, printing totals by day or for all of the entries in the
`wtmp' file.
`accton'
turns accounting on or off.
`last'
lists the logins on the system, most recent first. With `last',
you can search the `wtmp' file for a particular user or terminal
name (to which the user was connected). Of special interest are
two fake users, `reboot' and `shutdown', which are recorded when
the system is shut down or reboots.
`lastcomm'
lists the commands executed on the system, most recent first,
showing the run state of each command. With `last', you can
search the `acct' file for a particular user, terminal, or command.
`sa'
summarizes the information in the `acct' file into the `savacct'
and `usracct' file. It also generates reports about commands,
giving the number of invocations, cpu time used, average core
usage, etc.
`dump-acct'
`dump-utmp'
display `acct' and `utmp' files in a human-readable format.
For more detailed information on any of these programs, check the
chapter with the program title.
A Note on File Names and Locations
==================================
The `wtmp' and `acct' files seem to live in different places and
have different names for every variant of u*x that exists. The name
`wtmp' seems to be standard for the login accounting file, but the
process accounting file might be `acct' or `pacct' on your system. To
find the actual locations and names of these files on your system,
specify the `--help' flag to any of the programs in this package and
the information will dumped to standard output.
Regardless of the names and locations of files on your system, this
manual will refer to the login accounting file as `wtmp' and the
process accounting files as `acct', `savacct', and `usracct'.
History of the Accounting Utilities
===================================
I don't have any idea who originally wrote these utilities. If
anybody does, please send some mail to ` This e-mail address is being protected from spambots. You need JavaScript enabled to view it ' and I'll
add your information here!
Since the first alpha versions of this software in late 1993, many
people have contributed to the package. They are (in alphabetical
order):
`Eric Backus < This e-mail address is being protected from spambots. You need JavaScript enabled to view it >'
Suggested fixes for HP-UX 9.05 using /bin/cc: configure assumed
you were using `gcc' and tacked on `-Wall' etc. He also noticed
that `file_rd.c' was doing pointer arithmetic on a `void *' pointer
(non-ANSI).
`Christoph Badura < This e-mail address is being protected from spambots. You need JavaScript enabled to view it >'
Christoph was a BIG HELP in computing statistics, most notably
k*sec stuff! He also did Xenix testing and contributed some
Makefile fixes and output optimizations.
`Michael Calwas < This e-mail address is being protected from spambots. You need JavaScript enabled to view it >'
Fixed bugs in mktime.c.
`Alan Cox < This e-mail address is being protected from spambots. You need JavaScript enabled to view it >'
Original Linux kernel accounting patches.
`Scott Crosby < This e-mail address is being protected from spambots. You need JavaScript enabled to view it >'
Suggested idea behind `--sort-real-time' for `sa'.
`Solar Designer < This e-mail address is being protected from spambots. You need JavaScript enabled to view it >'
Fixed off-by one error in allocations in `sa'.
`Dirk Eddelbuettel < This e-mail address is being protected from spambots. You need JavaScript enabled to view it >'
Managed bug-fixes & etc. for Debian distribution, as well as the
architect of merge of GNU + Debian distributions. A big thanks to
Dirk for kicking me back into gear again after a long period of no
work on this project.
`Jason Grant < This e-mail address is being protected from spambots. You need JavaScript enabled to view it >'
Identified a buffer-overrun bug in `sa'.
`Kaveh R. Ghazi < This e-mail address is being protected from spambots. You need JavaScript enabled to view it >'
Tested the package on many systems with compilers other than gcc.
Fixed K&R C support.
`Susan Kleinmann < This e-mail address is being protected from spambots. You need JavaScript enabled to view it >'
Contributed excellent man pages!
`Marek Michalkiewicz < This e-mail address is being protected from spambots. You need JavaScript enabled to view it >'
Suggested the `--ip-address' flag for `last'.
`David S. Miller < This e-mail address is being protected from spambots. You need JavaScript enabled to view it >'
Noticed missing GNU-standard makefile rules.
`Walter Mueller < This e-mail address is being protected from spambots. You need JavaScript enabled to view it >'
Noticed install target was missing, and corrected a typo for
prefix in Makefile.in.
`Ian Murdock < This e-mail address is being protected from spambots. You need JavaScript enabled to view it >'
Tracked down miscellaneous bugs in sa.c under Linux. Added Debian
package maintenance files.
`Luc I. Suryo < This e-mail address is being protected from spambots. You need JavaScript enabled to view it >'
Suggested the `--user' flag for `lastcomm'.
`Pedro A M Vazquez < This e-mail address is being protected from spambots. You need JavaScript enabled to view it >'
Fixed bugs in sa.c and tested under FreeBSD.
`Marco van Wieringen < This e-mail address is being protected from spambots. You need JavaScript enabled to view it >'
Modified (wrote?) Linux kernel accounting patches.
File: accounting.info, Node: ac, Next: accton, Prev: Preface, Up: Top
`ac'
****
The `ac' command prints out a report of connect time (in hours)
based on the logins/logouts in the current `wtmp' file. A total is
also printed out.
The accounting file `wtmp' is maintained by `init' and `login'.
Neither of these programs creates the file; if the file is not there,
no accounting is done. To begin accounting, create the file with a
length of zero. *NOTE:* the `wtmp' file can get really big, really
fast. You might want to trim it every once and a while.
GNU `ac' works nearly the same u*x `ac', though it's a little
smarter in its printing out of daily totals--it actually prints *every*
day, rather than skipping to the date of the next entry in the `wtmp'
file.
Flags
=====
All of the original `ac''s options have been implemented, and a few
have been added. Normally, when `ac' is invoked, the output looks like
this:
total 93867.14
where total is the number of hours of connect time for every entry in
the `wtmp' file. The rest of the flags modify the output in one way or
another.
`-d'
`--daily-totals'
Print totals for each day rather than just one big total at the
end. The output looks like this:
Jul 3 total 1.17
Jul 4 total 2.10
Jul 5 total 8.23
Jul 6 total 2.10
Jul 7 total 0.30
`-p'
`--individual-totals'
Print time totals for each user in addition to the usual
everything-lumped-into-one value. It looks like:
bob 8.06
goff 0.60
maley 7.37
root 0.12
total 16.15
`PEOPLE'
Print out the sum total of the connect time used by all of the
users included in people. Note that people is a space separated
list of valid user names; wildcards are not allowed.
`-f FILENAME'
`--file FILENAME'
Read from the file FILENAME instead of the system's `wtmp' file.
`--complain'
When the `wtmp' file has a problem (a time-warp, missing record,
or whatever), print out an appropriate error.
`--reboots'
Reboot records are *not* written at the time of a reboot, but when
the system restarts; therefore, it is impossible to know EXACTLY
when the reboot occurred. Users may have been logged into the
system at the time of the reboot, and many `ac''s automatically
count the time between the login and the reboot record against the
user (even though all of that time *shouldn't* be, perhaps, if the
system is down for a long time, for instance). If you want to
count this time, include the flag. *To make `ac' behave like the
one that was distributed with your OS, include this flag.*
`--supplants'
Sometimes a logout record is not written for a specific terminal,
so the time that the last user accrued cannot be calculated. If
you want to include the time from the user's login to the next
login on the terminal (though probably incorrect), include this
flag. *To make `ac' behave like the one that was distributed with
your OS, include this flag.*
`--timewarps'
Sometimes, entries in a `wtmp' file will suddenly jump back into
the past without a clock change record occurring. It is
impossible to know how long a user was logged in when this occurs.
If you want to count the time between the login and the time warp
against the user, include this flag. *To make `ac' behave like the
one that was distributed with your OS, include this flag.*
`--compatibility'
This is shorthand for typing out the three above options.
`-a'
`--all-days'
If we're printing daily totals, print a record for every day
instead of skipping intervening days where there is no login
activity. Without this flag, time accrued during those
intervening days gets listed under the next day where there is
login activity.
`-y'
`--print-year'
Print out the year when displaying dates.
`--print-zeros'
If a total for any category (save the grand total) is zero, print
it. The default is to suppress printing.
`--debug'
Print verbose internal information.
`--tw-leniency VALUE'
Set the time warp leniency value (in seconds). Records in `wtmp'
files might be slightly out of order (most notably when two logins
occur within a one-second period - the second one gets written
first). By default, this value is set to 1 second. Some `wtmp''s
are really screwed up (Suns) and require a larger value here. If
the program notices this problem, time is not assigned to users
unless the `--timewarps' flag is used. See the Problems section
for more information.
`--tw-suspicious VALUE'
Set the time warp suspicious value (in seconds). If two records
in the `wtmp' file are farther than this number of seconds apart,
there is a problem with the wtmp file (or your machine hasn't been
used in a year). If the program notices this problem, time is not
assigned to users unless the `--timewarps' flag is used.
`-V'
`--version'
Print `ac''s version number.
`-h'
`--help'
Print `ac''s usage string and default locations of system files to
standard output.




