RUNACCT(8) System Manager's Manual RUNACCT(8)
runacct - run daily accounting
/usr/lib/acct/runacct [ mmdd [ state ] ]
runacct is the main daily accounting shell procedure. It is normally
initiated using cron(8). runacct processes connect, fee, disk, and
process accounting files. It also prepares summary files for prdaily
or billing purposes.
runacct takes care not to damage active accounting files or summary
files in the event of errors. It records its progress by writing
descriptive diagnostic messages into active. When an error is
detected, a message is written to /dev/console, mail (see mail(1)) is
sent to root, and runacct terminates. runacct uses a series of lock
files to protect against re-invocation. The files lock and lock1 are
used to prevent simultaneous invocation, and lastdate is used to pre-
vent more than one invocation per day.
runacct breaks its processing into separate, restartable states using
statefile to remember the last state completed. It accomplishes this
by writing the state name into statefile. runacct then looks in state-
file to see what it has done and to determine what to process next.
states are executed in the following order:
SETUP Move active accounting files into working files.
WTMPFIX Verify integrity of the wtmp file, correcting
date changes if necessary.
CONNECT1 Produce connect session records in ctmp.h format.
CONNECT2 Convert ctmp.h records into tacct.h format.
PROCESS Convert process accounting records into tacct.h
MERGE Merge the connect and process accounting records.
FEES Convert output of chargefee into tacct.h format
and merge with connect and process accounting
DISK Merge disk accounting records with connect,
process, and fee accounting records.
MERGETACCT Merge the daily total accounting records in day-
tacct with the summary total accounting records
CMS Produce command summaries.
USEREXIT Any installation-dependent accounting programs
can be included here.
CLEANUP Cleanup temporary files and exit.
To restart runacct after a failure, first check the active file for
diagnostics, then fix up any corrupted data files, such as pacct or
wtmp. The lock files and lastdate file must be removed before runacct
can be restarted. The argument mmdd is necessary if runacct is being
restarted, and specifies the month and day for which runacct will rerun
the accounting. Entry point for processing is based on the contents of
statefile; to override this, include the desired state on the command
line to designate where processing should begin.
To start runacct:
nohup runacct 2>> /var/adm/acct/nite/fd2log &&
To restart runacct:
nohup runacct 0601 2>>>> /var/adm/acct/nite/fd2log &&
To restart runacct at a specific state:
nohup runacct 0601 MERGE 2>>>> /var/adm/acct/nite/fd2log &&
acctcom(1), mail(1), acct(2V), acct(5), utmp(5V), acct(8), acctcms(8),
acctcon(8), acctmerg(8), acctprc(8), acctsh(8), cron(8), fwtmp(8)
Normally it is not a good idea to restart runacct in the SETUP state.
Run SETUP manually and restart using:
runacct mmdd WTMPFIX
If runacct failed in the PROCESS state, remove the last ptacct file
because it will not be complete.
17 January 1990 RUNACCT(8)