acctcon1 or acctcon2 Command

Purpose

Performs connect-time accounting.

Syntax

acctcon1-l File ] [  -o File ] [  -p ] [  -t ] [ -X ]

acctcon2 [ -X ]

Description

acctcon1

The acctcon1 command is called by the runacct command to convert a sequence of login and logoff records (read from standard input) to a sequence of login session records (written to standard output). Input is normally redirected from the /var/adm/wtmp file. The input file can be a file other than /var/adm/wtmp, as long as it is in the correct format.

The acctcon1 command displays the following in ASCII format:

The acctcon1 command also maintains a list of ports on which users are logged in. When the acctcon1 command reaches the end of its input, the command writes a session record for each port that still appears to be active. Unless the -t flag is used, the acctcon1 command assumes that input is a current file and uses the current time as the ending time for each session still in progress.

The summary file generated with the -l flag helps an administrator track line usage and identify bad lines. All hang-ups, terminations of the login command, and terminations of the login shell cause the system to write logoff records. Consequently, the number of logoffs is often much higher than the number of sessions.

acctcon2

The acctcon2 command, also called by the runacct command, converts a sequence of login session records produced by the acctcon1 command into connect-time total accounting records. These records are merged with other total accounting records by the acctmerg command to produce a daily report.

Flags

Note: The following flags are used with the acctcon1 command.
Item Description
-l File (lowercase L) Writes a line-usage summary file showing the line name, the number of minutes used, the percentage of total elapsed time, the number of sessions charged, the number of logins, and the number of logoffs. If you do not specify a file name, the system creates the information in the /var/adm/acct/nite/lineuse file.
-o File Writes to the specified file an overall record for the accounting period, giving starting time, ending time, number of restarts, and number of date changes. If you do not specify a file name, the system creates the /var/adm/acct/nite/reboots file.
-p Displays only input. Line name, login name, and time are shown in both numeric and date/time formats. Without the -p flag specified, the acctcon1 command would display input, converting input to session records, and write reports.
-t Uses the last time found in the input as the ending time for any current processes. This, rather than current time, is necessary in order to have reasonable and repeatable values for files that are not current.
-X Prints and processes all available characters for each user name instead of truncating to the first 8 characters.
Note: The following flag can be used with both the acctcon1 and acctcon2 commands.

Security

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

Examples

  1. To convert a sequence of login records (in the /var/adm/wtmp file) to a sequence of login session records (stored in the /var/adm/logsess file), include the following in a shell script:
    acctcon1 -t -l/var/adm/acct/nite/lineuse \
    -o/var/adm/acct/nite/reboots \
    </var/adm/wtmp > /var/adm/logsess 
    The login session reports show an ending time that corresponds with the last time input was provided. Two reports are generated: a line-usage summary file named /var/adm/acct/nite/lineuse, an overall record for the accounting period, reported in the /var/adm/acct/nite/reboots file.
  2. To convert a series of login session records (in the /var/adm/acct/nite/ctmp file) to a total accounting record (stored in the /var/adm/logacct file), include the following in a shell script:
    acctcon2 < /var/adm/acct/nite/ctmp \
     > /var/adm/logacct

Files

Item Description
/usr/sbin/acct/acctcon1 Contains the acctcon1 command.
/usr/sbin/acct/acctcon2 Contains the acctcon2 command.
/var/adm/wtmp Contains connect-time accounting data, including login, logout, and shutdown records.