JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
System Administration Guide: Advanced Administration     Oracle Solaris 10 8/11 Information Library
search filter icon
search icon

Document Information

About This Book

1.  Managing Terminals and Modems (Overview)

2.  Setting Up Terminals and Modems (Tasks)

3.  Managing Serial Ports With the Service Access Facility (Tasks)

4.  Managing System Resources (Overview)

5.  Displaying and Changing System Information (Tasks)

6.  Managing Disk Use (Tasks)

7.  Managing UFS Quotas (Tasks)

8.  Scheduling System Tasks (Tasks)

9.  Managing System Accounting (Tasks)

What's New in System Accounting

Oracle Solaris Process Accounting and Statistics Improvements

What is System Accounting?

How System Accounting Works

System Accounting Components

Connect Accounting

Process Accounting

Disk Accounting

Fee Calculations

How Daily Accounting Works

What Happens If the System Shuts Down

System Accounting (Task Map)

Setting Up System Accounting

How to Set Up System Accounting

Billing Users

How to Bill Users

Maintaining Accounting Information

Fixing Corrupted Files and wtmpx Errors

How to Fix a Corrupted wtmpx File

Fixing tacct Errors

How to Fix tacct Errors

Restarting the runacct Script

How to Restart the runacct Script

Stopping and Disabling System Accounting

How to Temporarily Stop System Accounting

How to Permanently Disable System Accounting

10.  System Accounting (Reference)

11.  Managing System Performance (Overview)

12.  Managing System Processes (Tasks)

13.  Monitoring System Performance (Tasks)

14.  Troubleshooting Software Problems (Overview)

15.  Managing System Messages

16.  Managing Core Files (Tasks)

17.  Managing System Crash Information (Tasks)

18.  Troubleshooting Miscellaneous Software Problems (Tasks)

19.  Troubleshooting File Access Problems (Tasks)

20.  Resolving UFS File System Inconsistencies (Tasks)

21.  Troubleshooting Software Package Problems (Tasks)


Setting Up System Accounting

You can set up system accounting to run while the system is in multiuser mode (Run Level 2). Generally, this task involves these steps:

  1. Creating the /etc/rc0.d/K22acct and /etc/rc2.d/S22acct startup scripts

  2. Modifying the /var/spool/cron/crontabs/adm and /var/spool/cron/crontabs/root crontab files

The following table describes the default accounting scripts.

Table 9-1 Default Accounting Scripts

Accounting Script
Man Page
Run Frequency
Checks the size of the /usr/adm/pacct log file and makes sure that it does not get too large.
Processes connect, disk, and fee accounting information. You can remove from this script the commands for the accounting features you do not want processed.
Generates fiscal accounting summary reports on a monthly basis. You can determine how often this script is run. You can remove from this script the commands for the accounting features you do not want to use.
On a fiscal basis

You can choose which accounting scripts run by default. After these entries have been added to the crontab files, system accounting should run automatically.

How to Set Up System Accounting

  1. Become superuser or assume an equivalent role.

    Roles contain authorizations and privileged commands. For more information about roles, see Configuring RBAC (Task Map) in System Administration Guide: Security Services.

  2. If necessary, install the SUNWaccr and SUNWaccu packages on your system by using the pkgadd command.
  3. Install /etc/init.d/acct as the startup script for Run Level 2.
    # ln /etc/init.d/acct /etc/rc2.d/S22acct
  4. Install /etc/init.d/acct as the stop script for Run Level 0.
    # ln /etc/init.d/acct /etc/rc0.d/K22acct
  5. Add the following lines to the adm crontab file to start the ckpacct, runacct, and monacct scripts automatically.
    # EDITOR=vi; export EDITOR
    # crontab -e adm
    0 * * * * /usr/lib/acct/ckpacct
    30 2 * * * /usr/lib/acct/runacct 2> /var/adm/acct/nite/fd2log
    30 7 1 * * /usr/lib/acct/monacct
  6. Add the following line to the root crontab file to start the dodisk script automatically.
    # crontab -e
    30 22 * * 4 /usr/lib/acct/dodisk
  7. Edit /etc/acct/holidays to include national holidays and local holidays.

    For more information, see the holidays(4) man page and the example that follows.

  8. Reboot the system, or start system accounting manually by typing:
    # /etc/init.d/acct start

Example 9-1 Setting Up Accounting (adm crontab)

This modified adm crontab contains entries for the ckpacct, runacct, and monacct scripts.

#ident  "@(#)adm        1.5     92/07/14 SMI"    /* SVr4.0 1.2   */
# The adm crontab file should contain startup of performance 
# collection if the profiling and performance feature has been 
# installed.
0 * * * * /usr/lib/acct/ckpacct
30 2 * * * /usr/lib/acct/runacct 2> /var/adm/acct/nite/fd2log
30 7 1 * * /usr/lib/acct/monacct

Example 9-2 Setting Up Accounting (root crontab)

This modified root crontab contains entries for the dodisk program.

#ident  "@(#)root       1.19    98/07/06 SMI"   /* SVr4.0       */
# The root crontab should be used to perform accounting data collection.
10 3 * * * /usr/sbin/logadm
15 3 * * 0 /usr/lib/fs/nfs/nfsfind
30 3 * * * [ -x /usr/lib/gss/gsscred_clean ] && /usr/lib/gss/gsscred_clean
30 22 * * 4 /usr/lib/acct/dodisk

Example 9-3 Setting Up Accounting (/etc/acct/holidays)

The following example shows a sample /etc/acct/holidays file.

* @(#)holidays    January 1, 2004
* Prime/Nonprime Table for UNIX Accounting System
* Curr    Prime    Non-Prime
* Year    Start    Start
  2004    0800    1800
* only the first column (month/day) is significant.
* month/day    Company
*         Holiday
1/1        New Years Day
7/4        Indep. Day
12/25        Christmas