Runs daily accounting.
/usr/sbin/acct/runacct [ mmdd [ State ] ]
The runacct command is the main daily accounting shell procedure. Normally initiated by the cron daemon, the runacct command processes connect, fee, disk, queuing system (printer), and process accounting data files for the current day to produce the binary daily report, /var/adm/acct/nite/dayacct. The runacct command also prepares summary files for the prdaily procedure to prepare the ASCII daily report, /var/adm/acct/sum/rprtmmdd, or for billing purposes.
The acctmerg command adds the dayacct report to the cumulative summary report for the accounting period, /var/adm/acct/sum/tacct. The tacct report is used by the monacct command to produce the monthly report, /var/adm/acct/fiscal.
This command has two parameters that must be entered from the keyboard should you need to restart the runacct procedure. The date parameter, mmdd, enables you to specify the day and month for which you want to rerun the accounting. The State parameter enables a user with administrative authority to restart the runacct procedure at any of its states. For more information on restarting runacct procedures and on recovering from failures, refer to "Restarting runacct Procedures".
The runacct command protects active accounting files and summary files in the event of run-time errors, and records its progress by writing descriptive messages into the /var/adm/acct/nite/active file. When the runacct procedure encounters an error, it sends mail to users root and adm, and exits.
The runacct procedure also creates two temporary files, lock and lock1, in the directory /var/adm/acct/nite, which it uses to prevent two simultaneous calls to the runacct procedure. It uses the lastdate file (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 the /var/adm/acct/nite/state file. The runacct procedure processes the various states in the following order:
|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.|
|CONNECT1||Calls the acctcon1 command 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 the chargefee command 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 the daytacct report file with the summary total accounting records in the /var/adm/acct/sum/tacct report file.|
|CMS||Produces command summaries in the file /var/adm/acct/sum/cms.|
|USEREXIT||If the /var/adm/siteacct shell file exists, calls it at this point to perform site-dependent processing.|
|CLEANUP||Deletes temporary files and exits.|
To restart the runacct command after a failure, first check the /var/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 /var/adm/acct/nite directory), before restarting the runacct command. You must specify the mmdd parameter if you are restarting the runacct command. It specifies the month and day for which the runacct command is to rerun the accounting. The runacct procedure determines the entry point for processing by reading the /var/adm/acct/nite/statefile file. To override this default action, specify the desired state on the runacct command line.
It is not usually a good idea to restart the runacct command in the SETUP state. Instead, perform the setup actions manually and restart accounting with the WTMPFIX state, as follows:
/usr/lib/acct/runacct mmdd WTMPFIX
If the runacct command fails in the PROCESS state, remove the last ptacct file, because it will be incomplete.
Access Control: This command should grant execute (x) access only to members of the adm group.
0 4 * * 1-6 /usr/sbin/acct/runacct 2> \ /var/adm/acct/nite/accterrThis example shows the instructions that the cron daemon will read and act upon. The runacct command will run at 4 a.m. (04 ) every Monday through Saturday (1-6 ) and write all standard error output (2> ) to the /var/adm/acct/nite/accterr file. This command is only one of the accounting instructions normally given to the cron daemon. See "Setting Up an Accounting System" in AIX Version 4.3 System Management Guide: Operating System and Devices for more information on typical cron accounting entries.
nohup /usr/sbin/acct/runacct 2> \ /var/adm/acct/nite/accterr &Although it is preferable to have the cron daemon start the runacct procedure automatically (see example 1), you can give the command from the keyboard. The runacct command will run in the background (& ), ignoring all INTERRUPT and QUIT signals (the nohup command), and write all standard error output (2> ) to the /var/adm/acct/nite/accterr file.
nohup /usr/sbin/acct/runacct 0601 2>> \ /var/adm/acct/nite/accterr &This example restarts runacct for the day of June 1 (0601 ). The runacct command reads the file /var/adm/acct/nite/statefile to find out the state with which to begin. The runacct command will run in the background (& ), ignoring all INTERRUPT and QUIT signals (nohup). Standard error output (2 ) is added to the end (>> ) of the /var/adm/acct/nite/accterr file.
nohup /usr/sbin/acct/runacct 0601 MERGE 2>> \ /var/adm/acct/nite/accterr &This example restarts the runacct command for the day of June 1 (0601 ), starting with the MERGE state. The runacct command will run in the background (& ), ignoring all INTERRUPT and QUIT signals (the nohup command). Standard error output (2 ) is added to the end (>> ) of the /var/adm/acct/nite/accterr file.
|/var/adm/wtmp||Log in/log off history file.|
|/var/adm/pacct*||Process accounting file.|
|/var/adm/acct/nite/daytacct||Disk usage accounting file.|
|/var/adm/qacct||Active queue accounting file.|
|/var/adm/fee||Record of fees charged to users.|
|/var/adm/acct/sum/*||Command and total accounting summary files.|
|/var/adm/acct/nite/ptacct*.mmdd||Concatenated version of pacct files.|
|/var/adm/acct/nite/active||The runacct message file.|
|/var/adm/acct/nite/lock*||Prevents simultaneous invocation of runacct.|
|/var/adm/acct/nite/lastdate||Contains last date runacct was run.|
|/var/adm/acct/nite/statefile||Contains current state to process.|
The acctcms command, acctcom command, acctcon1 or acctcon2 command, acctmerg command, acctprc1, acctprc2, or accton command, crontab command, fwtmp command.
The cron daemon.
The acct subroutine.
The acct file format, utmp, wtmp, failedlogin file format.
For more information about the Accounting System, the preparation of daily and monthly reports, and the accounting files, see the Accounting Overview in AIX Version 4.3 System Management Guide: Operating System and Devices.
Setting Up an Accounting System in AIX Version 4.3 System Management Guide: Operating System and Devices describes the steps you must take to establish an accounting system.
See the Accounting Commands in AIX Version 4.3 System Management Guide: Operating System and Devices for a list of accounting commands that can be run automatically or entered from the keyboard.