To allow runacct
to be started and stopped properly,
processing is broken down into separate states.
A file is used to remember the last state completed.
When each state completes, statefile
is updated to reflect the next state.
After processing for the state is complete,
statefile is read and the next state is processed.
When runacct reaches the CLEANUP
state, it removes the locks and ends.
States are executed as follows:
The command turnacct switch
is executed to create a new pacct file.
The process accounting files in
/var/adm/pacct? (except the
pacct file) are moved to
The /var/adm/wtmp file is moved to
(with the current time record added on the end)
and a new /var/adm/wtmp is created.
closewtmp and utmp2wtmp
add records to wtmp.MMDD and the new wtmp
to account for users currently logged in.
program checks the wtmp.MMDD file
in the nite directory for correctness.
Because some date changes cause
acctcon to fail, wtmpfix
attempts to adjust the timestamps in the wtmp
file if a record of a date change appears.
It also deletes any corrupted entries from the
wtmp file. The fixed version of
wtmp.MMDD is written to tmpwtmp.
program records connect accounting records in the file
ctacct.MMDD. These records are in
format. In addition, acctcon creates the
lineuse and reboots files. The
reboots file records all the boot records found in the
wtmp file. CONNECT
was previously two steps called
CONNECT1 and CONNECT2.
The acctprc program
is used to convert the process accounting files
into total accounting records in
The Spacct and ptacct
files are correlated by number so if
fails, Spacct files are not reprocessed unnecessarily.
when restarting runacct
in this state, remove the last
file because it will not be complete.
Merge the process accounting records with
the connect accounting records to form
Merge any ASCII
tacct records from the file fee into
If the disktacct
file has been produced (by running the
procedure), merge that file into
daytacct and move disktacct to
Merge daytacct with sum/tacct,
the cumulative total accounting file.
Each day, daytacct is saved in
sum/tacct.MMDD so sum/tacct
can be recreated if it is corrupted or lost.
The program acctcms is run several times.
It is first run to generate a command summary (using the
Spacct? files), which it writes to
sum/daycms. acctcms is then run to merge
sum/daycms with the cumulative command summary file
sum/cms. Finally, acctcms is run to produce the
ASCII command summary files nite/daycms and
nite/cms from the files
sum/daycms and sum/cms, respectively.
The program lastlogin is run to create
the report of when each user last logged on.
(If runacct is run after midnight,
records of the date and time some users
last logged on will be incorrect by one day.)
Any installation-dependent (local) accounting program
can be included here. runacct
expects it to be called /usr/lib/acct/runacct.local.
Clean up temporary files, run prdaily
(saving its output in sum/rprtMMDD),
remove the locks, and exit.
© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 22 April 2004