Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

acctmerg(8)

acct(8)

fwtmp(8)

init(8)

login(1)

acct(2)

acctcon(8)  —  Maintenance

OSF

NAME

acctcon1, acctcon2 − Outputs connect-time accounting summaries

SYNOPSIS

acctcon1 [-l file] [-o file] [-p] [-t]

acctcon2

FLAGS

-l  fileWhen this flag is used, acctcon1 writes a columnar format called "line usage" to file. The acctcon1 command rewrites records from the source file (usually /var/adm/wtmp) to file as line usage records for the accounting period during which the file /var/adm/wtmp is active.  The line-usage summary format lists the line name in a LINE column, the number of session minutes used in a MINUTES column, the percentage of total elapsed time used for the sessions in a PERCENT column, the number of sessions charged in a # SESS column, the number of logins in a # ON column, and the number of logouts in a # OFF column. The acctcon1 command rewrites the /var/adm/wtmp input file records as shown in the following example ASCII line-usage heading format. 

TOTAL DURATION:mm MINUTES
LINE    MINUTES    PERCENT    # SESS    # ON    # OFF
TOTALS

In the foregoing line-usage format example, mm is the total number of minutes used for connect sessions during the accounting period during which the file /var/adm/wtmp is active. The last line in the line-usage file totals the entries for each column. The line-usage format helps an administrator track line usage and identify bad lines. All hangups, terminations of the login command, and terminations of the login shell cause the system to write logout records, so that the number of logouts is often greater than the number of sessions. 

-o fileWhen this flag is used, acctcon1 writes a file format called "overall record" from source file information (usually the /var/adm/wtmp file) to file. The destination file is an overall record for the accounting period during which the /var/adm/wtmp file is active. This file lists a starting time, an ending time, the number of restarts, and the number of date changes. The acctcon1 command rewrites /var/adm/wtmp information to file as shown in the following example ASCII overall record format:

from mon day date hh:mm:ss yy tz
to   mon day date hh:mm:ss yy tz
2    date changes  Number of times the date was changed.
21   acctg off     Number of times accounting functions were turned off.
25   run-level S   Number of times accounting functions ran in single-user mode.
108  system boot   Number of times the system was rebooted.
21   acctg on      Number of times accounting functions were turned on.
21   acctcon1      Number of times the acctcon1 command was issued.

The default date and timestamp format is mon day date hh:mm:ss yy tz where mon is the month, day is the day of the week, hh:mm:ss is the time expressed in hours (in 24-hour notation), minutes, and seconds, yy is the year express as a 4-digit number and tz is the name of the time zone. In the overall-record format, from is the accounting period start time and to is the accounting period end time. 

-pWrites /var/adm/wtmp file information to the default output device.  The output columnar format lists the line reference name 1 (see the following example list), the login name 2, the time in seconds since the Epoch 3, the date 4 through 5, the 24-hour clock time 6, the year 7, and the name of the time zone 8.  The input records from the /var/adm/wtmp source file are written to the destination, which is the default output device.  The acctcon1 command rewrites the /var/adm/wtmp input file records as shown in the following example:

    1        2        3       4   5      6       7     8
pty/ttyp1  hoff   616883748  Jul  19  16:35:48  1990  EST
pty/ttyp1  hoff   616883825  Jul  19  16:37:05  1990  EST
pty/ttyp1  LOGIN  616883833  Jul  19  16:37:13  1990  EST
pty/ttyp1  tom    616883837  Jul  19  16:37:17  1990  EST

-tThe acctcon1 command also maintains a list of ports on which users are logged in. When the acctcon1 command reaches the end of its input, a session record is written for each port that still appears to be active. The acctcon1 command assumes that the input source is
a current file and uses current time as the ending time for each session still in progress. The -t flag uses the last time found in the input as the ending time for any current processes. This, rather than current time, is necessary to have reasonable and repeatable values for noncurrent files. The output format is the same as the default output format. 

DESCRIPTION

The acctcon1 and acctcon2 commands are described separately. 

acctcon1

The acctcon1 command is normally called by the runacct shell procedure to write a sequence of login and logout records (stored in the /var/adm/wtmp file). One record for each connect session is written to a specified destination as a sequence of login session records. The input records should be redirected from the /var/adm/wtmp source file as input to the destination, which is the default output device. The acctcon1 command rewrites the /var/adm/wtmp input file records as shown in the following example of the ASCII default columnar output format:

    1       2     3   4     5         6       7   8      9       10   11
285212673  1192  hoff 85    0     616883748  Jul  19  16:35:48  1990  EST
285212673  1033  tom  10    0     616883837  Jul  19  16:37:17  1990  EST
285212673  0     root 1345  2852  616883855  Jul  19  16:37:35  1990  EST
285212673  1120  jim  0     62    616888058  Jul  19  17:47:38  1990  EST

In the foregoing example output records have no column headings; the numbers in boldface type are for reference. The default format output columns have the following significance:

1The device address expressed as a decimal equivalent of the major/minor device address at which the connection was activated. 

2The user ID assigned for the connect-session record. 

3The user login name under which the session took place. 

4The total number of prime-time seconds for the connect session. 

5The total number of nonprime-time seconds for the connect session. 

6The number of seconds since the Epoch. The Epoch is referenced absolutely to 0 hours, 0 minutes 0 seconds, 1 January 1970. 

7The month of the year expressed as an initial-capitalized, 3-letter string. 

8The day of the month expressed as a decimal number. 

9The connect-session starting time expressed in hours, minutes, and seconds. 

10The year expressed as a 4-digit number. 

11The name of the current time zone. 

For any column entries referenced 7 through 11 in the foregoing example that produce date and timestamp information in an output file, the order of date and time information is locale dependent.  The date and timestamps shown in the examples are for the default headings, but their order may be changed using the NLTIME environment variable to change the timestamp format. 

acctcon2

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

EXAMPLES

Individual Session Records

To convert login records (in the /var/adm/wtmp file) to a default format login session record report (written to a file called /var/adm/logsess), include the following line in an accounting shell script:

acctcon1 -t /var/adm/lineuse -o /var/adm/reboots < /var/adm/wtmp > /var/adm/logsess

Three files are generated. The output file /var/adm/logsess lists ending date and 24-hour timestamp records that correspond with the last time that input was provided (obtained with the -t flag). Two other files are generated: a line-usage summary file (/var/adm/lineuse) obtained with the -l flag, and an overall record file (/var/adm/reboots) obtained with the -o flag, for the accounting period covered by the /var/adm/wtmp file. 

Total Accounting Records

To convert a series of login session records (in the /var/adm/logsess file) to a total accounting record (stored in a /var/adm/logacct binary file), include the following line in a shell script after the /var/adm/logsess file is produced:

acctcon2 < /var/adm/logsess > /var/adm/logacct

FILES

/usr/sbin/acct/acctcon1
Specifies command path.

/usr/sbin/acct/acctcon2
Specifies command path.

/var/adm/wtmp
The active login/logout database file.

/usr/include/sys/acct.h, /usr/include/utmp.h
Accounting header files that define formats for writing accounting files.

RELATED INFORMATION

Commands: acctmerg(8), acct(8), fwtmp(8), init(8), login(1)

Functions: acct(2)

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026