runacct(1M) runacct(1M)
runacct - run daily accounting
/usr/lib/acct/runacct [mmdd [state]]
runacct is the main daily accounting shell procedure. It is normally
initiated via cron. 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 adm, 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 prevent 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 statefile
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 wtmp file, correcting date changes if
necessary.
CONNECT Produce connect session records in tacct.h format.
PROCESS Convert process accounting records into tacct.h format.
MERGE Merge the connect and process accounting records.
FEES Convert output of chargefee into tacct.h format and merge
with connect and process accounting records.
DISK Merge disk accounting records with connect, process, and fee
accounting records.
MERGETACCT Merge the daily total accounting records in daytacct with
the summary total accounting records in
/var/adm/acct/sum/tacct.
CMS Produce command summaries.
Page 1
runacct(1M) runacct(1M)
USEREXIT Any installation dependent accounting programs can be
included here.
CLEANUP Clean up temporary files and exit.
To restart runacct after a failure, first check the active and fd2log
files for diagnostics, then fix any corrupted data files, such as pacct
or wtmp. The lock, lock1, and lastdate files 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 reruns
the accounting. The 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.
The report generation commands check the environment in order to allocate
enough memory to handle system with large configuration. The environment
variables can be set in the appropriate crontab files where runacct is
usually invoked.
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 &
/var/adm/wtmp
/var/adm/pacctincr
/usr/src/cmd/acct/tacct.h
/usr/src/cmd/acct/ctmp.h
/var/adm/acct/nite/active
/var/adm/acct/nite/daytacct
/var/adm/acct/nite/lock
/var/adm/acct/nite/lock1
/var/adm/acct/nite/lastdate
/var/adm/acct/nite/statefile
acct(1M), acctcms(1M), acctcom(1), acctcon(1M), acctmerg(1M),
acctprc(1M), acctsh(1M), cron(1M), fwtmp(1M), mail(1), acct(2), acct(4),
utmp(4).
Page 2
runacct(1M) runacct(1M)
Normally it is not a good idea to restart runacct in the SETUP state.
Run SETUP manually and restart via:
runacct mmdd <b>WTMPFIX
If runacct failed in the PROCESS state, remove the last ptacct file
because it is not complete.
Each time runacct is run, it resets the /var/adm/wtmp file. This make
programs like last(1) less useful.
PPPPaaaaggggeeee 3333 [ Back ]
|