Using system accounting

Setting Up Accounting

To set up system accounting so it will be running while the system is in multiuser state (system state 2), you need to create and/or modify four files:

Make sure the accounting utilities have been installed on your system.

Use this procedure to set up system accounting to run while the system is in multiuser state (system state 2).

  1. If you want accounting to be shut off during shutdown, link /etc/init.d/acct to /etc/rc0.d/K22acct.

  2. If you want accounting to be turned on when the system is in multiuser state (system state 2), link /etc/init.d/acct to /etc/rc2.d/S22acct.

  3. Put the cron entries needed for accounting into a database called /var/spool/cron/crontabs/adm. This file should contain entries requesting ckpacct to be run periodically, runacct to be run daily, and monacct to be run on a fiscal basis.

    The following example shows several sample entries; your entries may vary. (Note that the comment lines in the file shown here may not appear in your file; they are included to clarify the meaning of the fields shown.)

    #-------------------entries for adm crontab------------------------------
    #Min  Hour  Day    Month  Day   Command
    #           of            of
    #           Month         Week
    0     0     *      *      *     >/var/adm/wtmp
    0     0     *      *      *     >/var/adm/wtmpx
    0     *     *      *      *     /usr/lib/acct/ckpacct
    30    2     *      *      *  /usr/lib/acct/runacct 2> /var/adm/acct/nite/fd2log
    30    9     *      *      5     /usr/lib/acct/monacct

  4. Comment out (prepend a # (pound) sign to each) the following two lines in the file /var/spool/cron/crontab/adm:
       0 0 * * *  >/var/adm/wtmp
       0 0 * * *  >/var/adm/wtmpx
    In a delivered system, these two entries are included for controlling the growth of wtmp files on systems without the accounting utilities.

    Because you are running the accounting utilities, you won't want these entries to be active; but don't delete them in case the accounting utilities are later removed from your system. Commenting them out makes these entries inactive (that is, neutralizes their effect on accounting),

    If you find any other entries in /var/spool/cron/crontab/adm, leave them alone.

  5. For the adm crontab, assign root as the owner, sys as the group, and 644 as the permissions mode.

  6. Append an entry for dodisk to the root crontab /var/spool/cron/crontabs/root.

    For example,

    #--------------------entry for root crontab--------------------------------
    #Min  Hour  Day      Month    Day   Command
    #           of                of
    #           Month             Week
    30    22    *     *     4     /usr/lib/acct/dodisk

    Once these entries are in the database and the accounting programs have been installed, accounting will run on its own.

© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 22 April 2004