csarun(1M) csarun(1M) NAME csarun - processes the daily accounting files and generates reports SYNOPSIS /usr/lib/acct/csarun [-A] [-V level] [MMDD [hhmm [state]]] DESCRIPTION The csarun command, usually initiated by cron(1M), directs the processing of the daily accounting files. csarun processes accounting records written into the pacct file. If errors occur, csarun does not damage the active accounting file. It records its progress by writing descriptive diagnostic messages to the active file. When an error is detected, a message is written to the SYSLOG file, and mail is sent to root and adm. Further data processing is halted. Before invoking csarun on a new accounting period, ensure that the previous invocation of csarun has completed successfully. If this is not done, information about unfinished jobs will not be accurate. The lock and lock1 files are used to protect against simultaneous invocation. The csarun command accepts the following options and operands: -A Accounts for both terminated and active jobs. By default, only terminated jobs are reported. csarun does not recycle active jobs when this option is specified. -V level Controls verification level of accounting data files. MMDD [hhmm [state]] Sets month, day, hour, minute, and state for which csarun will rerun the accounting. If csarun is restarted, the month and day are necessary; other portions are optional. If you supply the state on the command line, you must also specify hhmm. The csarun command breaks its processing into separate, restartable states using statefile to remember the last state completed. It accomplishes this by writing the state name into statefile. csarun looks in statefile to determine what must be processed next. The states are executed in the following order: State Name Description SETUP Moves active accounting files into a work directory. VERIFY Verifies the integrity of the data files. ARCHIVE1 User exit that executes a site-generated accounting script to archive the accounting files. BUILD Organizes the accounting data into a sorted pacct file. ARCHIVE2 User exit that executes a site-generated accounting script to archive the sorted pacct file. CMS Generates command summaries. REPORT Generates daily accounting reports. DREP Generates daemon usage report. FEF User exit that executes a site-generated accounting script to format the sorted pacct file into a format that is suitable for use on a front end. USEREXIT User exit that executes a site-generated accounting script. CLEANUP Cleans up temporary files and exits. Before restarting csarun after a failure, check the active file for diagnostics, then fix any corrupted pacct files. The lock files must be removed before csarun can be restarted. If csarun is restarted, you must specify the MMDD operand, which specifies the month and day for which csarun will rerun the accounting. The entry point for processing is based on the contents of statefile. To override this entry point, include the desired state on the command line to designate where processing should begin. NOTES The mail recipients (root and adm) can be changed by modifying the MAIL_LIST and WMAIL_LIST parameters in the /etc/csa.conf file. You also can change the other parameters defined in the accounting configuration file for your site. csarun checks the number of free blocks in the filesystem that contains the accounting files to ensure that it consists of more than 2000 blocks. Block size is 1024 bytes. By default, csarun assumes that the filesystem is /var; if this is not the case, change symbol ACCT_FS in /etc/csa.conf accordingly. To change the minimum number of free blocks on ACCT_FS (the default is 2000), modify MIN_BLKS in the configuration file. To remove bad records in accounting data files encountered by csarun, use csaedit(1M) and csaverify(1M). You need to make sure that csarun can read the site-generated user exit scripts. If csarun cannot read the scripts, it does not handle the error graciously like it does for other errors. This means the error will not be logged in the SYSLOG file and the active file, and no notification email will be sent out. BUGS If possible, do not restart csarun in the SETUP state. Instead, run SETUP manually and restart csarun by using the following command line: csarun MMDD hhmm VERIFY If csarun terminates abnormally and leaves the lock files in place, the next execution of csarun will remove these locks, but it also will terminate abnormally. EXAMPLES Example 1: The following example shows how to start csarun: nohup csarun 2> /var/adm/acct/nite/csa/fd2log & Example 2: The following example shows how to restart csarun at the state specified in statefile: nohup csarun 0601 1345 2>> /var/adm/acct/nite/csa/fd2log & Example 3: The following example shows how to restart csarun at a specific state: nohup csarun 0601 1345 BUILD 2>> /var/adm/acct/nite/csa/fd2log & FILES /etc/csa.conf Accounting configuration file /var/adm/acct/day/* Directory that contains current accounting files /var/adm/acct/nite/csa/active Record of accounting progress /var/adm/acct/nite/csa/clastdate Record of last date and time that accounting ran /var/adm/acct/nite/csa/lock Lock file that prevents simultaneous invocation /var/adm/acct/nite/csa/lock1 Lock file that prevents simultaneous invocation /var/adm/acct/nite/csa/statefile Record of last state that csarun was working on or completed /var/adm/acct/sum/csa/* Directory that contains daily condensed data files and accounting reports /var/adm/acct/work/* Directory that contains temporary files from daily accounting /usr/lib/acct/csa.archive1 Site-generated user exit script to be executed during the ARCHIVE1 state. /usr/lib/acct/csa.archive2 Site-generated user exit script to be executed during the ARCHIVE2 state. /usr/lib/acct/csa.fef Site-generated user exit script to be executed during the FEF state. /usr/lib/acct/csa.user Site-generated user exit script to be executed during the USEREXIT state. SEE ALSO cron(1M), csaaddc(1M), csabuild(1M), csacms(1M), csacon(1M), csacrep(1M), csadrep(1M), csaedit(1M), csajrep(1M), csaperiod(1M), csarecy(1M), csaverify(1M), acctctl(3c). Page 4