acctprc1, acctprc2, or accton Command

Purpose

Performs process-accounting procedures.

Syntax

/usr/sbin/acct/acctprc1InFile ]

/usr/sbin/acct/acctprc2 [ -X ]

/usr/sbin/acct/accton [ [-@] OutFile ]

Description

The three acctprc commands, acctprc1, acctprc2, and accton, are called by the runacct command to perform process-accounting shell procedures.

The acctprc1 command reads records from standard input that are in the acct format, adds the login names that correspond to user IDs, and then writes an ASCII record to standard output. This record contains the user ID, login name, prime CPU time, nonprime CPU time, the total number of characters transferred (in 1024-byte units), the total number of blocks read and written, and mean memory size (in 64-byte units) for each process.

If specified, the InFile parameter contains a list of login sessions in utmp format, sorted by user ID and login name. If the File parameter is not specified, acctprc1 gets login names from the/etc/passwd password file. The information in the InFile parameter helps distinguish among different login names that share the same user ID.

The acctprc2 command reads (from standard input) the records written by the acctprc1 command, summarizes them by user ID and name, and writes the sorted summaries to standard output as total accounting records.

When the accton command is used without parameters, process accounting is turned off. If you specify the OutFile parameter (an existing file), process accounting is turned on, and the kernel adds records to that file. You must specify the OutFile parameter for process accounting to start. The OutFile parameter is not created by the accton command. The file specified by the OutFile parameter must already exist with the proper group, owner, and permissions. Many shell scripts expect the /var/adm/pacct file.

Flags

Item Description
-X Process all available characters for each use rname instead of truncating to the first 8 characters. This flag also causes the acctprc2 command to produce tacctx formatted binary records instead of tacct binary records.
Note: This flag can only be used with the acctprc2 command.
-@ Include workload partition process accounting records in the global WPARs accounting output file. This option is not valid inside a workload partition.

Security

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

Examples

  1. To add a user name to each process-accounting record in a binary file and convert the records to an ASCII file named out.file, enter the following commands or use the lines in a shell script:
    /usr/sbin/acct/acctprc1 < /var/adm/pacct >out.file
  2. To produce a total accounting record of the ASCII output file in example 1, enter the following commands or use the lines in a shell script:
    /usr/sbin/acct/acctprc2 < out.file > \
    /var/adm/acct/nite/daytacct 
    The resulting file is a binary total accounting file in tacct format, containing individual records sorted by user ID. The file /var/adm/acct/nite/daytacct is merged with other total accounting records by the acctmerg command to produce the daily summary record in the /var/adm/acct/sum/tacct file.
  3. To turn off process accounting, enter:
    /usr/sbin/acct/accton

Files

Item Description
/usr/sbin/acct/acctprc1 Contains the acctprc1 command.
/usr/sbin/acct/acctprc2 Contains the acctprc2 command.
/usr/sbin/acct/accton Contains the accton command.
/etc/accton Symbolic link to the actual accton command directory.
/etc/passwd Contains the basic user attributes, including the user IDs used by the acctprc1 command.