Table of Contents
The main daily accounting script, runacct, is normally invoked by the cron command outside of normal business hours. The runacct script processes connect, fee, disk, and process accounting files. This script also prepares daily and cumulative summary files for use by the prdaily and monacct scripts for billing purposes.
The runacct script takes care not to damage files if errors occur. A series of protection mechanisms that are used to perform the following tasks:
Recognize an error
Provide intelligent diagnostics
Complete processing in such a way that the runacct script can be restarted with minimal intervention
This script records its progress by writing descriptive messages to the active
file. Files used by the runacct script are assumed
to be in the /var/adm/acct/nite
directory, unless otherwise noted.
All diagnostic output during the execution of the runacct script
is written to the fd2log
file.
When the runacct script is invoked, it creates the lock
and lock1
files. These files are used to prevent
simultaneous execution of the runacct script. The runacct program prints an error message if these files exist when it is invoked.
The lastdate
file contains the month and day the runacct script was last invoked, and is used to prevent more than one execution
per day. If the runacct script detects an error, the following
occurs:
A message is written to the console
Email is sent to root
and adm
Locks might be removed
Diagnostics are saved
Execution is ended
For instructions on how to restart the runacct script, see How to Restart the runacct
Script.
To allow the runacct script to be restarted, processing
is broken down into separate re-entrant states. The statefile
file
is used to track the last state completed. When each state is completed, the statefile
file is updated to reflect the next state. After processing for
the state is complete, the statefile
file is read and the next
state is processed. When the runacct script reaches the CLEANUP
state, it removes the locks and ends. States are executed as shown
in the following table.
Table 17.1. States of the runacct Script
State |
Description |
---|---|
|
The turnacct switch command is executed
to create a new |
|
The wtmpfix program checks the |
|
The acctcon program is used to record connect accounting
records in the file |
|
The acctprc program is used to convert the |
|
The acctmerg program merges the process accounting records
with the connect accounting records to form the |
|
The acctmerg program merges ASCII |
|
The dodisk script produces the |
|
The acctmerg program merges the |
|
The acctcms program is run several times. This program is
first run to generate the command summary by using the |
|
Any installation-dependent (local) accounting program can be run at this point. The runacct script expects this program to be called the /usr/lib/acct/runacct.local program. |
|
This state cleans up temporary files, runs the prdaily script
and saves its output in the |