RUNACCT(8,C) AIX Commands Reference RUNACCT(8,C) ------------------------------------------------------------------------------- runacct PURPOSE Runs daily accounting. SYNTAX +---------------------+ /usr/lib/acct/runacct ---| +---------+ |---| +- mmdd --| |-+ +- state -+ ^ | +-------+ DESCRIPTION The runacct command is the main daily accounting shell procedure. Normally initiated by cron, runacct processes connect, fee, disk, queueing system and process accounting data files. It also prepares summary files for the prdaily procedure or for billing purposes. The runacct command protects active accounting files and summary files in the event of run-time errors. It records its progress by writing descriptive messages into the file /usr/adm/acct/nite/active. When runacct encounters an error, it writes a diagnostic message to /dev/console, sends mail to users "root" and "adm", and exits. The runacct procedure also creates two temporary files, lock and lock1 in the directory /usr/adm/acct/nite, which it uses to prevent two simultaneous calls to runacct. It uses the file lastdate (in the same directory), to prevent more than one invocation per day. The runacct command breaks its processing into separate, restartable states. As it completes each state, it writes the name of the next state in /usr/adm/acct/nite/statefile. runacct processes the various states in the following order: State Actions SETUP Moves the active accounting files to working files and restarts the active files. WTMPFIX Verifies the integrity of the wtmp file, correcting date changes if necessary. Processed November 8, 1990 RUNACCT(8,C) 1 RUNACCT(8,C) AIX Commands Reference RUNACCT(8,C) CONNECT1 Calls acctcon1 to produce connect session records. CONNECT2 Converts connect session records into total accounting records (tacct.h format). PROCESS Converts process accounting records into total accounting records (tacct.h format). MERGE Merges the connect and process total accounting records. FEES Converts the output of chargefee into total accounting records (tacct.h format) and merges them with the connect and process total accounting records. DISK Merges disk accounting records with connect, process, and fee total accounting records. QUEUEACCT Sorts the queue (printer) accounting records, converts them into total accounting records (tacct.h format), and merges them with other total accounting records. MERGETACCT Merges the daily total accounting records in daytacct with the summary total accounting records in /usr/adm/acct/sum/tacct. CMS Produces command summaries in the file /usr/adm/acct/sum/cms. USEREXIT If the shell file //adm/siteacct exists, calls it at this point to perform site-dependent processing. CLEANUP Deletes temporary files and exit. To restart runacct after a failure, first check the /usr/adm/acct/nite/active file for diagnostic messages, then fix any damaged data files such as pacct or wtmp. Remove the lock files and lastdate file (all in the /usr/adm/acct/nite directory), before restarting runacct. You must specify the mmdd parameter if you are restarting runacct. It specifies the month and day for which runacct is to rerun the accounting. runacct determines the entry point for processing by reading statefile. To override this default action, specify the desired state on the runacct command line. For a more detailed discussion of restarting runacct, see Managing the AIX Operating System. It is not usually a good idea to restart runacct in the SETUP state. Instead, perform the setup actions manually and restart accounting with the WTMPFIX state, as follows: runacct mmdd WTMPFIX If runacct fails in the PROCESS state, remove the last ptacct file, because it will be incomplete. EXAMPLES Processed November 8, 1990 RUNACCT(8,C) 2 RUNACCT(8,C) AIX Commands Reference RUNACCT(8,C) 1. To start runacct: nohup /usr/lib/acct/runacct 2> /usr/adm/acct/nite/accterr & This starts runacct in the background ("&"), ignoring all INTERRUPT and QUIT signals (nohup). All standard error output is written to the file "/usr/adm/acct/nite/accterr". 2. To restart runacct: nohup /usr/lib/acct/runacct 0601 2>> /usr/adm/acct/nite/accterr & This restarts runacct for the day of June 1 ("0601"). runacct reads the file /usr/adm/acct/nite/statefile to find out the state to begin with. Standard error output is added to the end of the file "/usr/adm/acct/nite/accterr". 3. To restart runacct in a specific state, in this case the MERGE state: nohup /usr/lib/acct/runacct 0601 MERGE 2>> /usr/adm/acct/nite/accterr & FILES /usr/adm/wtmp Login/logout history file. //adm/pacct* Process accounting file. /usr/adm/acct/nite/daytacct Disk usage accounting file. /usr/adm/qacct Active queue accounting file. /usr/adm/fee Record of fees charge to users. /usr/adm/acct/sum/* Command and total accounting summary files. /usr/adm/acct/nite/ptacct*.mmdd Concatenated version of pacct files. /usr/adm/acct/nite/active runacct message file. /usr/adm/acct/nite/lock* Prevent simultaneous invocation of runacct. /usr/adm/acct/nite/lastdate Contains last date runacct was run. /usr/adm/acct/nite/statefile Contains current state to process. RELATED INFORMATION See the following commands: "acct/*," "acctcms," "acctcom," "acctcon1, acctcon2," "acctmerg," and "cron." See the acct system call and the acct and utmp files in AIX Operating System Technical Reference. See "Running System Accounting" in Managing the AIX Operating System. Processed November 8, 1990 RUNACCT(8,C) 3