DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Using system accounting

runacct states

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:


SETUP
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 /var/adm/Spacct?.MMDD. The /var/adm/wtmp file is moved to /var/adm/acct/nite/wtmp.MMDD (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.

WTMPFIX
The wtmpfix 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.

CONNECT
The acctcon program records connect accounting records in the file ctacct.MMDD. These records are in tacct.h 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.

PROCESS
The acctprc program is used to convert the process accounting files /var/adm/Spacct?.MMDD, into total accounting records in ptacct?..MMDD The Spacct and ptacct files are correlated by number so if runacct fails, Spacct files are not reprocessed unnecessarily.


CAUTION: when restarting runacct in this state, remove the last ptacct file because it will not be complete.


MERGE
Merge the process accounting records with the connect accounting records to form daytacct.

FEES
Merge any ASCII tacct records from the file fee into daytacct.

DISK
If the disktacct file has been produced (by running the dodisk procedure), merge that file into daytacct and move disktacct to /tmp/disktacct.MMDD.

MERGETACCT
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.

CMS
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 /var/adm/acct/sum/loginlog, 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.)

USEREXIT
Any installation-dependent (local) accounting program can be included here. runacct expects it to be called /usr/lib/acct/runacct.local.

CLEANUP
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