acctdisk, acctdusg Command

Purpose

Performs disk-usage accounting.

Syntax

/usr/sbin/acct/acctdisk

/usr/sbin/acct/acctdusg [ -u File ] [ -p File ] [ -X ]

Description

The acctdisk and acctdusg commands are called by the dodisk command to perform disk-usage accounting. Usually, this procedure is initiated when the cron daemon runs the dodisk command.

Normally, the output of the diskusg command becomes the input of the acctdisk command. If a more thorough but slower version of disk accounting is needed, use the dodisk -o command to call the acctdusg command instead of the diskusg command.

Accounting is only done for files on the local file system for local users. System administrators who want to count remote users (such as YP clients or diskless clients) should use the acctdusg -p command.

acctdisk

The acctdisk command reads the output lines of the diskusg or acctdusg commands from standard input, converts each individual record into a total accounting record, and writes the records to standard output. These records are merged with other accounting records by the acctmerg command to produce the daily accounting report.

acctdusg

The acctdusg command is called by using the dodisk -o command, when a slow and thorough version of disk accounting is needed. Otherwise, the dodisk command calls the diskusg command.

The acctdusg command reads a list of files from standard input (usually piped from a find / -print command), computes the number of disk blocks (including indirect blocks) allocated to each file owner, and writes an individual record for each user to standard output. By default, the command searches for login names and numbers in the /etc/passwd file. You can search other files by specifying the -p File flag and variable. Each output record has the following form:

uid login #blocks

The #blocks value is the number of 1KB blocks utilized by the user.

Flags

Item Description
-p File Searches the specified file for login names and numbers, instead of searching the /etc/passwd file.
-u File Places, in the specified file, records of the file names that are exempt from charges.
-X Turns on long username support.

Security

Access Control: These commands should grant execute (x) access only to members of the adm group.

Examples

  1. To start normal disk accounting procedures, add a line similar the following to a crontab file so that the cron daemon runs disk accounting commands automatically:
    0 2 * * 4 /usr/sbin/acct/dodisk 
    In this example, the dodisk procedure runs at 2 a.m. (0 2) every Thursday (4) and the dodisk procedure calls the diskusg and acctdisk commands to write disk usage records to the /usr/adm/acct/nite/dacct file.
  2. To start a thorough disk accounting procedure, add a line similar the following to a crontab file so that the cron daemon runs disk accounting commands automatically:
    0 2 * * 4 /usr/sbin/acct/dodisk -o
    In this example, the dodisk procedure runs at 2 a.m. (0 2) every Thursday (4) and the dodisk procedure calls the acctdusg and acctdisk commands to write disk usage records to the /var/adm/acct/nite/dacct file.

Files

Item Description
/usr/sbin/acct/acctdisk Contains the acctdisk command.
/usr/sbin/acct/acctdusg Containsthe acctdusg command.
/etc/passwd Contains the basic attributes of user.
/usr/sbin/acct Directory holding all accounting commands.