[AIX 운영 체제와 장치 관리 15] 시스템 계정 — 계정 보고서(일별·월별·접속 시간·디스크·프린터·요금), 계정 명령, 계정 파일과 runacct

핵심 정리

  • 계정 시스템은 adm 그룹이 정한 자원 사용 합계로 사용자에게 요금을 매기고, 자원 배정의 적절성 평가와 한도·할당량 설정, 수요 예측에 쓰입니다.
  • runacct가 매일 /var/adm/acct/sum(x)/rprtMMDD에 일별 보고서(Daily, Daily Usage, Daily Command Summary, Monthly Total Command Summary, Last Login)를 만들고, acctmerg가 접속 시간·프로세스·디스크·프린터·요금 데이터를 합칩니다. monacct는 월이나 회계 기간 요약을 만듭니다.
  • ckpacct는 /var/adm/pacct가 500블록을 넘으면 새 pacct 파일로 바꾸고, 빈 디스크 블록이 500 아래로 떨어지면 프로세스 계정을 끕니다.
  • 긴 사용자 이름은 기본으로 8자에서 잘립니다. -X 플래그로 켜면 sumx, nitex, fiscalx 디렉터리를 씁니다.
  • runacct가 실패하면 active 파일과 accterr를 확인해 오류를 없앤 뒤 nohup runacct MMDD [상태]로 다시 시작합니다. 상태를 주지 않으면 statefile에서 이어 갑니다.
항목 내용
버전 AIX 6.1 (5.3판과 거의 같음)
원문 Operating system and device management — 5.3판 240251쪽, 6.1판 151161쪽
관련 명령어 runacct, acctmerg, monacct, ckpacct, dodisk, acctcom, acctcon1, chargefee, prtacct, sa, lastlogin, sar
관련 파일 /var/adm/pacct, /var/adm/wtmp, /var/adm/fee, /var/adm/acct/nite(x), /var/adm/acct/sum(x), /var/adm/acct/fiscal(x)

시스템 계정 유틸리티로 여러 시스템 자원의 개인·그룹 사용을 모으고 보고할 수 있습니다.

이 계정 정보로 사용자가 쓴 시스템 자원에 요금을 매기고, 시스템 운영의 특정 측면을 감시할 수 있습니다. 요금 청구를 돕기 위해 계정 시스템은 adm 그룹 구성원이 정의한 자원 사용 합계를 제공하고, chargefee 명령을 쓰면 청구 요금도 반영합니다.

계정 시스템은 또 현재 자원 배정이 적절한지 평가하고, 자원 한도와 할당량을 정하고, 앞으로의 수요를 예측하고, 프린터와 다른 장치의 소모품을 주문하는 데 쓸 데이터도 제공합니다.

다음 정보는 시스템에 계정 유틸리티를 구현하는 방법을 이해하는 데 도움이 됩니다.

관련 개념

  • 프로세스 관리 — 프로세스는 운영 체제가 시스템 자원 사용을 제어하는 데 쓰는 개체입니다.
  • 워크로드 관리자 — WLM은 스케줄러, 가상 메모리 관리자(VMM), 디스크 I/O 하위 시스템이 프로세스에 자원을 배정하는 방식을 시스템 관리자가 더 잘 제어하게 합니다.
  • 클래스별 계정 — AIX 계정 시스템 유틸리티로 여러 시스템 자원의 사용을 사용자, 그룹, WLM 클래스별로 모으고 보고할 수 있습니다.

관련 작업

  • /var 파일 시스템의 넘침 해결 — /var 파일 시스템이 가득 찼을 때 확인할 사항입니다.

관련 정보

  • AIX Version 6.1 Advanced Accounting Subsystem
영어 원문

System accounting

The system accounting utility allows you to collect and report on individual and group use of various system resources.

This accounting information can be used to bill users for the system resources they utilize, and to monitor selected aspects of the system operation. To assist with billing, the accounting system provides the resource-usage totals defined by members of the adm group, and, if the chargefee command is included, factors in the billing fee.

The accounting system also provides data to assess the adequacy of current resource assignments, set resource limits and quotas, forecast future needs, and order supplies for printers and other devices.

The following information should help you understand how to implement the accounting utility in your system.

Related concepts

Process management The process is the entity that the operating system uses to control the use of system resources. Threads can control processor-time consumption, but most system management tools still require you to refer to the process in which a thread is running, rather than to the thread itself. Workload manager Workload Manager (WLM) is designed to provide the system administrator with increased control over how the scheduler virtual memory manager (VMM) and the disk I/O subsystem allocate resources to processes. Per class accounting The AIX accounting system utility lets you collect and report the use of various system resources by user, group, or WLM class.

Related tasks

Resolving overflows in the /var file system Check the following when the /var file system has become full.

Related information

AIX Version 6.1 Advanced Accounting Subsystem

계정 데이터 보고서

여러 종류의 계정 데이터를 모은 뒤 레코드를 처리해 보고서로 바꿉니다.

계정 명령은 숫자가 커지면 레코드를 과학적 표기법으로 자동 변환합니다. 과학적 표기법은 다음 형식으로 나타냅니다.

Basee+Exp

Basee-Exp

이것은 Base 수에 10의 +Exp 또는 -Exp 제곱을 곱한 수입니다. 예를 들어 1.345e+9는 1.345×10⁹, 곧 1,345,000,000이고, 1.345e-9는 1.345×10⁻⁹, 곧 0.000000001345입니다.

관련 개념

  • 프로세스 계정 데이터 — 계정 시스템은 각 프로세스가 실행되는 동안 자원 사용 데이터를 모읍니다.

일별 계정 보고서

일별 보고서를 만들려면 runacct 명령을 씁니다.

이 명령은 데이터를 요약해 /var/adm/acct/sum(x)/rprtMMDD라는 ASCII 파일에 넣습니다. MMDD는 보고서를 실행한 월과 일입니다. 보고서에는 다음이 들어 있습니다.

  • 일별 보고서(Daily report)
  • 일별 사용 보고서(Daily Usage report)
  • 일별 명령 요약(Daily Command Summary)
  • 월간 총 명령 요약(Monthly Total Command Summary)
  • 마지막 로그인(Last Login)

일별 보고서

일별 계정 보고서에는 접속 시간, 프로세스, 디스크 사용, 프린터 사용, 청구 요금 데이터가 들어 있습니다.

acctmerg 명령은 접속 시간, 프로세스, 디스크 사용, 프린터 사용, 청구 요금에 관한 원시 계정 데이터를 합쳐 일별 보고서를 만듭니다. runacct 명령이 일별 작업의 일부로 호출하며, acctmerg 명령은 다음을 만듭니다.

파일 설명
/var/adm/acct/nite(x)/dacct 입력 파일 가운데 하나가 가득 찼을 때 만드는 중간 보고서
/var/adm/acct/sum(x)/tacct tacct 형식의 누적 합계 보고서. monacct 명령이 이 파일로 ASCII 월간 요약을 만듭니다.

acctmerg 명령은 레코드를 ASCII와 바이너리 형식 사이에서 바꾸고, 여러 출처의 레코드를 사용자마다 레코드 하나로 합칠 수 있습니다. acctmerg 명령에 관한 자세한 내용은 acctmerg를 봅니다.

일별 보고서의 첫 줄은 보고서에 모은 데이터의 시작과 끝 시각, 그리고 종료·재부팅·실행 수준 변경 같은 시스템 수준 이벤트 목록으로 시작합니다. 계정 기간에 포함된 총 분 수를 나타내는 총 기간도 나옵니다(24시간마다 보고서를 실행하면 보통 1440분). 보고서에는 다음 정보가 들어 있습니다.

열 설명
LINE 사용 중인 콘솔, tty, pty
MINUTES 회선을 사용한 총 분 수
PERCENT 계정 기간 가운데 회선을 사용한 시간의 백분율
# SESS 새로 시작한 로그인 세션 수
# ON # SESS와 같음
# OFF 회선에서 일어난 로그아웃과 인터럽트 수

일별 사용 계정 보고서

일별 사용 보고서는 계정 기간 동안의 사용자 ID별 시스템 사용을 요약한 보고서입니다.

일부 필드는 계정 관리자가 /usr/lib/acct/holidays 디렉터리(원문 그대로)에 정의한 대로 주 시간(prime)과 비주 시간(non-prime)으로 나뉩니다. 보고서에는 다음 정보가 들어 있습니다.

열 설명
UID 사용자 ID
LOGIN NAME 사용자 이름
CPU (PRIME/NPRIME) 사용자의 모든 프로세스가 쓴 총 CPU 시간(분)
KCORE (PRIME/NPRIME) 실행 중인 프로세스가 쓴 총 메모리(KB·분)
CONNECT (PRIME/NPRIME) 총 접속 시간(사용자가 로그인해 있던 시간, 분)
DISK BLOCKS 계정을 켠 모든 파일 시스템에서 사용자가 쓴 디스크 공간의 평균 총량
FEES chargefee 명령으로 입력한 총 요금
# OF PROCS 이 사용자에 속한 총 프로세스 수
# OF SESS 이 사용자의 서로 다른 로그인 세션 수
# DISK SAMPLES 계정 기간 동안 디스크 표본 조사를 한 횟수. 소유한 DISK BLOCKS가 없으면 0

일별 명령 요약 계정 보고서

일별 명령 요약 보고서는 계정 기간에 실행한 명령을 고유한 명령 이름마다 한 줄씩 보여 줍니다.

표는 (아래 설명하는) TOTAL KCOREMIN으로 정렬되며, 첫 줄은 모든 명령의 합계입니다. 명령마다 나오는 데이터는 계정 기간 동안 그 명령을 실행한 모든 횟수의 누적입니다. 이 표의 열은 다음과 같습니다.

열 설명
COMMAND NAME 실행한 명령
NUMBER CMDS 명령을 실행한 횟수
TOTAL KCOREMIN 명령 실행에 쓴 총 메모리(KB·분)
TOTAL CPU-MIN 명령이 쓴 총 CPU 시간(분)
TOTAL REAL-MIN 명령에 걸린 총 실제 시간(분)
MEAN SIZE-K CPU 1분당 명령이 쓴 평균 메모리 크기
MEAN CPU-MIN 명령 1회 실행당 평균 CPU 분
HOG FACTOR 명령이 활성인 동안 CPU를 얼마나 독차지하는지를 나타내는 값. TOTAL CPU-MIN을 TOTAL REAL-MIN으로 나눈 비율
CHARS TRNSFD 명령이 시스템 읽기·쓰기로 전송한 문자 수
BLOCKS READ 명령이 한 물리 블록 읽기와 쓰기 수

월간 총 명령 요약 계정 보고서

monacct 명령이 만드는 월간 총 명령 요약은 이전 월간 보고서 이후 실행한 모든 명령에 관한 정보를 제공합니다.

필드와 정보의 뜻은 일별 명령 요약과 같습니다.

마지막 로그인

마지막 로그인 보고서는 사용자 ID마다 필드 두 개를 보여 줍니다. 첫 필드는 YY-MM-DD 형식으로 그 사용자의 가장 최근 로그인을 나타냅니다. 둘째 필드는 사용자 계정 이름입니다.

날짜 필드가 00-00-00이면 그 사용자 ID는 한 번도 로그인하지 않았다는 뜻입니다.

계정 보고서 요약

원시 계정 데이터를 요약하는 보고서를 만들 수 있습니다.

원시 계정 데이터를 요약하려면 sa 명령을 씁니다. 이 명령은 보통 /var/adm/pacct 파일에 모이는 원시 계정 데이터와, 요약 데이터가 있으면 /var/adm/savacct 파일의 현재 사용 요약 데이터를 읽습니다. 이 정보를 새 사용 요약 보고서로 합치고, 이후 데이터 수집을 위해 원시 데이터 파일을 비웁니다.

전제 조건

sa 명령에는 pacct 파일(프로세스 계정 파일) 같은 원시 계정 데이터 입력 파일이 필요합니다. 원시 계정 데이터를 모으려면 계정 시스템을 설정해 실행 중이어야 합니다.

절차

sa 명령의 목적은 프로세스 계정 정보를 요약해 보여 주거나 저장하는 것입니다. 가장 간단하게 쓰면 읽고 있는 pacct 파일의 수명 동안 실행된 모든 프로세스에 관한 통계 목록을 보여 줍니다. 그런 목록을 만들려면 다음을 입력합니다.

text
/usr/sbin/sa

계정 정보를 요약해 요약 파일에 합치려면 다음을 입력합니다.

text
/usr/sbin/sa -s

sa 명령에는 계정 정보를 처리하고 보여 주는 방식을 정하는 플래그가 많습니다. 자세한 내용은 sa 명령 설명을 봅니다.

관련 작업

  • 계정 시스템 설정

월별 보고서

월별 계정 보고서를 만들 수 있습니다.

cron 데몬이 호출하는 monacct 명령은 다음을 만듭니다.

파일 설명
/var/adm/acct/fiscal monacct 명령이 /var/adm/acct/sum/tacct 보고서로 만드는 주기 요약 보고서. monacct 명령은 매달 또는 회계 기간 끝에 실행하도록 구성할 수 있습니다.

접속 시간 보고서

계정 레코드에는 로그인, 로그아웃, 시스템 종료, lastlogin 레코드가 있습니다.

runacct 명령은 두 명령 acctcon1과 acctcon2를 호출해 /var/adm/wtmp 파일에 모이는 로그인, 로그아웃, 시스템 종료 레코드를 처리합니다. acctcon1 명령은 이 레코드를 세션 레코드로 바꿔 /var/adm/acct/nite(x)/lineuse 파일에 씁니다. 그런 다음 acctcon2 명령이 세션 레코드를 총 계정 레코드 /var/adm/logacct로 바꾸고, acctmerg 명령이 이를 일별 보고서에 더합니다. 이 명령들에 관한 정보는 runacct, acctcon1, acctcon2를 봅니다.

명령행에서 acctcon1 명령을 실행하면 회선 사용 보고서 /var/adm/acct/nite(x)/lineuse를 만들려면 -l 플래그를 넣어야 합니다. 계정 기간의 전체 세션 보고서 /var/adm/acct/nite(x)/reboots를 만들려면 acctcon1 명령에 -o 플래그를 씁니다.

lastlogin 명령은 사용자마다 마지막으로 로그인한 날짜를 알려 주는 보고서를 만듭니다. lastlogin 명령에 관한 정보는 lastlogin을 봅니다.

관련 개념

  • 접속 시간 계정 데이터 — 접속 시간 데이터는 init 명령과 login 명령이 모읍니다.
  • 디스크 사용 계정 데이터 — 많은 계정 정보는 자원이 소비될 때 모입니다. cron 데몬의 지정대로 실행되는 dodisk 명령이 주기적으로 사용자마다 디스크 사용 레코드를 /var/adm/acct/nite(x)/dacct 파일에 씁니다.

디스크 사용 계정 보고서

/var/adm/acct/nite(x)/dacct 파일에 모인 디스크 사용 레코드는 acctmerg 명령이 일별 계정 보고서에 합칩니다.

acctmerg 명령에 관한 정보는 acctmerg를 봅니다.

프린터 사용 계정 보고서

/var/adm/qacct 파일의 ASCII 레코드는 총 계정 레코드로 바꿔 acctmerg 명령이 일별 보고서에 더할 수 있습니다.

acctmerg 명령에 관한 정보는 acctmerg를 봅니다.

관련 개념

  • 프린터 사용 계정 데이터 — 프린터 사용 데이터는 enq 명령과 큐 데몬이 함께 모읍니다.

요금 계정 보고서

파일 복원, 상담, 자재 같은 서비스에 chargefee 명령으로 사용자에게 요금을 매겼다면 ASCII 총 계정 레코드가 /var/adm/fee 파일에 기록됩니다. acctmerg 명령이 이 파일을 일별 보고서에 더합니다.

chargefee와 acctmerg 명령에 관한 정보는 chargefee와 acctmerg를 봅니다.

관련 개념

  • 요금 계정 데이터 — /var/adm/fee 파일에 ASCII 총 계정 레코드를 만들 수 있습니다.

회계 기간 계정 보고서

회계 기간 계정 보고서는 보통 monacct 명령으로 매달 모읍니다.

보고서는 /var/adm/acct/fiscal(x)/fiscrptMM에 저장되며, MM은 monacct 명령을 실행한 달입니다. 이 보고서에는 일별 보고서와 비슷한 정보를 한 달 전체로 요약한 내용이 들어 있습니다.

계정 시스템 활동 보고서

계정 시스템 활동을 보여 주는 보고서를 만들 수 있습니다.

시스템 활동 보고서를 만들려면 prtacct 명령을 씁니다. 이 명령은 총 계정 파일(tacct 파일 형식)의 정보를 읽어 서식 있는 출력을 만듭니다. 총 계정 파일에는 접속 시간, 프로세스 시간, 디스크 사용, 프린터 사용에 관한 일별 보고서가 들어 있습니다.

전제 조건

prtacct 명령에는 tacct 파일 형식의 입력 파일이 필요합니다. 곧 계정 시스템을 설정해 실행 중이거나 과거에 실행한 적이 있어야 합니다.

절차

다음을 입력해 시스템 활동 보고서를 만듭니다.

text
prtacct -f Specification -v Heading File

Specification은 acctmerg 명령이 쓰는 필드 번호나 범위를 쉼표로 구분한 목록입니다. 선택 -v 플래그는 부동소수점 수를 더 높은 정밀도로 보여 주는 자세한 출력을 만듭니다. Heading은 보고서에 나올 제목이며 선택입니다. File은 입력으로 쓸 총 계정 파일의 전체 경로 이름입니다. 파일을 여러 개 지정할 수 있습니다.

관련 작업

  • 계정 시스템 설정

8자보다 긴 사용자 이름 지원

모든 스크립트와의 하위 호환성을 유지하려고, 계정에서는 긴 사용자 이름 지원이 기본으로 켜져 있지 않습니다. 대신 모든 사용자 ID를 처음 8자로 자릅니다.

긴 사용자 이름 지원을 켤 수 있도록 대부분의 명령에 -X 플래그가 더해졌으며, 이 플래그를 쓰면 (ASCII와 바이너리 형식 모두에서) 8자보다 긴 사용자 ID를 받고 출력합니다. 또 긴 사용자 이름 지원을 켜면 명령과 스크립트는 /var/adm/acct/sum, /var/adm/acct/nite, /var/adm/acct/fiscal 대신 /var/adm/acct/sumx, /var/adm/acct/nitex, /var/adm/acct/fiscalx 디렉터리의 파일을 처리합니다.

영어 원문

Accounting data reports

After the various types of accounting data are collected, the records are processed and converted into reports.

Accounting commands automatically convert records into scientific notation when numbers become large. A number is represented in scientific notation in the following format:

Basee+Exp

Basee-Exp

which is the number equal to the Base number multiplied by 10 to the +Exp or -Exp power. For example, the scientific notation 1.345e+9 is equal to 1.345x109, or 1,345,000,000. And the scientific notation 1.345e-9 is equal to 1.345x10-9 or, 0.000000001345.

Related concepts

Process accounting data The Accounting system collects data on resource usage for each process as it runs.

Daily accounting reports

To generate a daily report, use the runacct command.

This command summarizes data into an ASCII file named /var/adm/acct/sum(x)/rprtMMDD. MMDD specifies the month and day the report is run. The report covers the following:

  • Daily report

  • Daily Usage report

  • Daily Command Summary

  • Monthly Total Command Summary

  • Last Login

Daily report

Daily accounting reports contain data on connect-time, processes, disk usage, printer usage, and fees to charge.

The acctmerg command merges raw accounting data on connect-time, processes, disk usage, printer usage, and fees to charge into daily reports. Called by the runacct command as part of its daily operation, the acctmerg command produces the following:

/var/adm/acct/nite(x)/dacct

An intermediate report that is produced when one of the input files is full.

/var/adm/acct/sum(x)/tacct

A cumulative total report in tacct format. This file is used by the monacct command to produce the ASCII monthly summary.

The acctmerg command can convert records between ASCII and binary formats and merge records from different sources into a single record for each user. For more information about the acctmerg command, see acctmerg.

The first line of the Daily report begins with the start and finish times for the data collected in the report, a list of system-level events including any existing shutdowns, reboots, and run-level changes. The total duration is also listed indicating the total number of minutes included within the accounting period (usually 1440 minutes, if the report is run every 24 hours). The report contains the following information:

  • LINE — Console, tty, or pty In use
  • MINUTES — Total number of minutes the line was in use
  • PERCENT — Percentage of time in the accounting period that the line was in use
  • # SESS — Number of new login sessions started
  • # ON — Same as # SESS
  • # OFF — Number of logouts plus interrupts made on the line

Daily Usage accounting report

The Daily Usage report is a summarized report of system usage per user ID during the accounting period.

Some fields are divided into prime and non-prime time, as defined by the accounting administrator in the /usr/lib/acct/holidays directory. The report contains the following information:

  • UID — User ID
  • LOGIN NAME — User name
  • CPU (PRIME/NPRIME) — Total CPU time for all of the user's processes in minutes
  • KCORE (PRIME/NPRIME) — Total memory used by running processes, in kilobyte-minutes
  • CONNECT (PRIME/NPRIME) — Total connect time (how long the user was logged in) in minutes
  • DISK BLOCKS — Average total amount of disk space used by the user on all filesystems for which accounting is enabled
  • FEES — Total fees entered with chargefee command
  • # OF PROCS — Total number of processes belonging to this user
  • # OF SESS — Number of distinct login sessions for this user
  • # DISK SAMPLES — Number of times disk samples were run during the accounting period. If no DISK BLOCKS are owned, the value will be zero

Daily Command Summary accounting report

The Daily Command Summary report shows each command executed during the accounting period, with one line per each unique command name.

The table is sorted by TOTAL KCOREMIN (described below), with the first line including the total information for all commands. The data listed for each command is cumulative for all executions of the command during the accounting period. The columns in this table include the following information:

  • COMMAND NAME — Command that was executed
  • NUMBER CMDS — Number of times the command executed
  • TOTAL KCOREMIN — Total memory used by running the command, in kilobyte-minutes
  • TOTAL CPU-MIN — Total CPU time used by the command in minutes
  • TOTAL REAL-MIN — Total real time elapsed for the command in minutes
  • MEAN SIZE-K — Mean size of memory used by the command per CPU minute
  • MEAN CPU-MIN — Mean numbr of CPU minutes per execution of the command
  • HOG FACTOR — Measurement of how much the command hogs the CPU while it is active. It is the ratio of TOTAL CPU-MIN over TOTAL REAL-MIN
  • CHARS TRNSFD — Number of characters transferred by the command with system reads and writes
  • BLOCKS READ — Number of physical block reads and writes performed by the command

Monthly Total Command Summary accounting report

The Monthly Total Command Summary, created by the monacct command, provides information about all commands executed since the previous monthly report.

The fields and information mean the same as those in the Daily Command Summary.

Last login

The Last Login report displays two fields for each user ID. The first field is YY-MM-DD and indicates the most recent login for the specified user. The second field is the name of the user account.

A date field of 00-00-00 indicates that the user ID has never logged in.

Accounting report summary

You can generate a report that summarizes raw accounting data.

To summarize raw accounting data, use the sa command. This command reads the raw accounting data, usually collected in the /var/adm/pacct file, and the current usage summary data in the /var/adm/savacct file, if summary data exists. It combines this information into a new usage summary report and purges the raw data file to make room for further data collection.

Prerequisites

The sa command requires an input file of raw accounting data such as the pacct file (process accounting file). To collect raw accounting data, you must have an accounting system set up and running.

Procedure

The purpose of the sa command is to summarize process accounting information and to display or store that information. The simplest use of the command displays a list of statistics about every process that has run during the life of the pacct file being read. To produce such a list, type:

text
/usr/sbin/sa

To summarize the accounting information and merge it into the summary file, type:

text
/usr/sbin/sa -s

The sa command offers many additional flags that specify how the accounting information is processed and displayed. See the sa command description for more information.

Related tasks

Setting up an accounting system You can set up an accounting system.

Monthly report

You can generate a Monthly accounting report.

Called by the cron daemon, the monacct command produces the following:

  • /var/adm/acct/fiscal — A periodic summary report produced from the /var/adm/acct/sum/tacct report by the monacct command. The monacct command can be configured to run monthly or at the end of a fiscal period.

Connect-time reports

Accounting records include login, logout, system-shutdown, and lastlogin records.

The runacct command calls two commands, acctcon1 and acctcon2, to process the login, logout, and system-shutdown records that collect in the /var/adm/wtmp file. The acctcon1 command converts these records into session records and writes them to the /var/adm/acct/nite(x)/lineuse file. The acctcon2 command then converts the session records into a total accounting record, /var/adm/logacct, that the acctmerg command adds to daily reports. For information about these commands, see runacct, acctcon1, and acctcon2.

If you run the acctcon1 command from the command line, you must include the -l flag to produce the line-use report, /var/adm/acct/nite(x)/lineuse. To produce an overall session report for the accounting period, /var/adm/acct/nite(x)/reboots, use the acctcon1 command with the -o flag.

The lastlogin command produces a report that gives the last date on which each user logged in. For information about the lastlogin command, see lastlogin.

Related concepts

Connect-time accounting data Connect-time data is collected by the init command and the login command. Disk-usage accounting data Much accounting information is collected as the resources are consumed. The dodisk command, run as specified by the cron daemon, periodically writes disk-usage records for each user to the /var/adm/acct/nite(x)/dacct file.

Disk-usage accounting report

The disk-usage records collected in the /var/adm/acct/nite(x)/dacct file are merged into the daily accounting reports by the acctmerg command.

For information about the acctmerg command, see acctmerg.

Printer-Usage accounting report

The ASCII record in the /var/adm/qacct file can be converted to a total accounting record to be added to the daily report by the acctmerg command.

For information about the acctmerg command, see acctmerg.

Related concepts

Printer-usage accounting data The collection of printer-usage data is a cooperative effort between the enq command and the queuing daemon.

Fee accounting report

If you used the chargefee command to charge users for services such as file restores, consulting, or materials, an ASCII total accounting record is written in the /var/adm/fee file. This file is added to the daily reports by the acctmerg command.

For information about the chargefee and acctmerg commands, see chargefee and acctmerg.

Related concepts

Fee accounting data You can produce an ASCII total accounting record in the /var/adm/fee file.

Fiscal accounting reports

The Fiscal Accounting Reports generally collected monthly by using the monacct command.

The report is stored in /var/adm/acct/fiscal(x)/fiscrptMM where MM is the month that the monacct command was executed. This report includes information similar to the daily reports summarized for the entire month.

Accounting system activity reports

You can generate a report that shows Accounting system activity.

To generate a report on system activity, use the prtacct command. This command reads the information in a total accounting file (tacct file format) and produces formatted output. Total accounting files include the daily reports on connect time, process time, disk usage, and printer usage.

Prerequisites

The prtacct command requires an input file in the tacct file format. This implies that you have an accounting system set up and running or that you have run the accounting system in the past.

Procedure

Generate a report on system activity by entering:

text
prtacct -f Specification -v Heading File

Specification is a comma-separated list of field numbers or ranges used by the acctmerg command. The optional -v flag produces verbose output where floating-point numbers are displayed in higher precision notation. Heading is the title you want to appear on the report and is optional. File is the full path name of the total accounting file to use for input. You can specify more than one file.

Related tasks

Setting up an accounting system You can set up an accounting system.

Greater than eight character username support

In order to maintain backwards compatibility with all scripts, long username support is not enabled by default within accounting. Instead, all user IDs are truncated to the first eight characters.

In order to enable long username support, most commands have been given the additional -X flag, which allows them to accept and output greater than eight-character user IDs (in both ASCII and binary formats). In addition, when long username support is enabled, commands and scripts will process files in the /var/adm/acct/sumx, /var/adm/acct/nitex, and /var/adm/acct/fiscalx directories, instead of using /var/adm/acct/sum, /var/adm/acct/nite, and /var/adm/acct/fiscal.

계정 명령

계정 명령은 여러 방식으로 동작합니다.

어떤 명령은 다음 일을 합니다.

  • 특정 종류의 계정(접속 시간, 프로세스, 디스크 사용, 프린터 사용, 명령 사용)에 대해 데이터를 모으거나 보고서를 만듭니다.
  • 다른 명령을 호출합니다. 예를 들어 보통 cron 데몬이 자동으로 실행하는 runacct 명령은 계정 데이터를 모으고 처리하고 보고서를 준비하는 여러 명령을 호출합니다. 자동 계정을 얻으려면 먼저 cron 데몬이 runacct 명령을 실행하도록 구성해야 합니다. cron 데몬이 정해진 간격으로 명령을 제출하도록 구성하는 방법은 crontab 명령을 봅니다. 이 명령들에 관한 정보는 runacct, cron 데몬, crontab을 봅니다.
  • 유지 보수 기능을 하고 활성 데이터 파일의 무결성을 보장합니다.
  • adm 그룹 구성원이 키보드에서 명령을 입력해 특정 레코드 표시 같은 가끔 하는 작업을 할 수 있게 합니다.
  • 사용자가 특정 정보를 볼 수 있게 합니다. 사용자 명령은 프로세스 계정 요약을 보여 주는 acctcom 명령 하나뿐입니다.

자동으로 실행되는 명령

여러 명령이 자동으로 계정 데이터를 모읍니다.

보통 cron 데몬이 실행하는 다음 명령이 자동으로 계정 데이터를 모읍니다.

명령 설명
runacct 주된 일별 계정 절차를 맡습니다. 보통 비주 시간에 cron 데몬이 시작하며, 다른 여러 계정 명령을 호출해 활성 데이터 파일을 처리하고 사용자 이름으로 정렬한 명령·자원 사용 요약을 만듭니다. 또 acctmerg 명령을 호출해 일별 요약 보고서 파일을 만들고, ckpacct 명령을 호출해 활성 데이터 파일의 무결성을 유지합니다.
ckpacct pacct 파일 크기를 다룹니다. 이 레코드 처리에 실패한 뒤 runacct 절차를 다시 시작해야 한다면 작은 pacct 파일이 여러 개 있는 편이 유리합니다. ckpacct 명령은 활성 데이터 파일 /var/adm/pacct의 크기를 확인해 500블록보다 크면 turnacct switch 명령으로 프로세스 계정을 잠시 끕니다. 데이터는 새 pacct 파일 /var/adm/pacctx로 옮겨집니다(x는 새 pacct 파일을 만들 때마다 커지는 정수). 빈 디스크 블록 수가 500 아래로 떨어지면 ckpacct 명령은 turnacct off 명령으로 프로세스 계정을 끕니다.
dodisk acctdisk 명령과, diskusg 명령이나 acctdusg 명령을 호출해 디스크 사용 레코드를 /var/adm/acct/nite/dacct 파일에 씁니다. 이 데이터는 나중에 일별 보고서에 합쳐집니다.
monacct 일별 보고서로 주기 요약을 만듭니다.
sa1 바이너리 데이터를 모아 /var/adm/sa/sadd 파일에 저장합니다. dd는 그 달의 날짜입니다.
sa2 일별 보고서를 /var/adm/sa/sardd 파일(원문은 sadd)에 씁니다. dd는 그 달의 날짜입니다. 이 명령은 일주일보다 오래된 보고서를 지웁니다.

다음 명령은 cron 데몬이 아닌 다른 절차가 자동으로 실행합니다.

명령 설명
startup /etc/rc 파일에 더하면 계정 시스템의 시작 절차를 시작합니다.
shutacct acctwtmp 명령을 호출해 /var/adm/wtmp 파일에 한 줄을 써서 계정을 끈 시각을 기록합니다. 그런 다음 turnacct off 명령을 호출해 프로세스 계정을 끕니다.

키보드 명령

adm 그룹 구성원은 키보드에서 다음 명령을 입력할 수 있습니다.

명령 설명
ac 접속 시간 레코드를 출력합니다. BSD(Berkeley Software Distribution) 시스템과의 호환을 위해 제공합니다.
acctcom 프로세스 계정 요약을 보여 줍니다. 일반 사용자도 쓸 수 있습니다.
acctcon1 접속 시간 요약을 보여 줍니다. -l이나 -o 플래그를 꼭 써야 합니다.
accton 프로세스 계정을 켜고 끕니다.
chargefee 수행한 작업 단위에 정해진 요금을 사용자에게 청구합니다. 요금은 acctmerg 명령이 일별 보고서에 더합니다.
fwtmp 파일을 바이너리와 ASCII 형식 사이에서 바꿉니다.
last 이전 로그인 정보를 보여 줍니다. BSD 시스템과의 호환을 위해 제공합니다.
lastcomm 마지막으로 실행한 명령 정보를 보여 줍니다. BSD 시스템과의 호환을 위해 제공합니다.
lastlogin 사용자마다 마지막으로 로그인한 시각을 보여 줍니다.
pac 프린터/플로터 계정 레코드를 준비합니다. BSD 시스템과의 호환을 위해 제공합니다.
prctmp 세션 레코드를 보여 줍니다.
prtacct 총 계정 파일을 보여 줍니다.
sa 많은 양의 계정 정보를 관리하기 쉽게 원시 계정 정보를 요약합니다. BSD 시스템과의 호환을 위해 제공합니다.
sadc 버퍼 사용, 디스크·테이프 I/O 활동, TTY 장치 활동 카운터, 파일 접근 카운터 같은 여러 로컬 시스템 동작을 보고합니다.
sar 운영 체제의 선택한 누적 활동 카운터 내용을 표준 출력에 씁니다. sar 명령은 로컬 활동만 보고합니다.
time 명령 실행에 걸린 실제 시간, 사용자 시간, 시스템 시간을 출력합니다.
timex 경과 시간, 사용자 시간, 실행 시간을 초 단위로 보고합니다.

관련 개념

  • 시스템 데이터 수집과 보고 — 시스템이 자동으로 데이터를 모으고 보고서를 만들도록 설정할 수 있습니다.
영어 원문

Accounting commands

The accounting commands function several different ways.

Some commands:

  • Collect data or produce reports for a specific type of accounting: connect-time, process, disk usage, printer usage, or command usage.

  • Call other commands. For example, the runacct command, which is usually run automatically by the cron daemon, calls many of the commands that collect and process accounting data and prepare reports. To obtain automatic accounting, you must first configure the cron daemon to run the runacct command. See the crontab command for more information about how to configure the cron daemon to submit commands at regularly scheduled intervals. For information about these commands, see runacct, cron daemon, and crontab.

  • Perform maintenance functions and ensure the integrity of active data files.

  • Enable members of the adm group to perform occasional tasks, such as displaying specific records, by entering a command at the keyboard.

  • Enable a user to display specific information. There is only one user command, the acctcom command, which displays process accounting summaries.

Commands that run automatically

Several commands automatically collect accounting data.

Several commands usually run by the cron daemon automatically collect accounting data. These commands are:

runacct

Handles the main daily accounting procedure. Normally initiated by the cron daemon during non-prime hours, the runacct command calls several other accounting commands to process the active data files and produce command and resource usage summaries, sorted by user name. It also calls the acctmerg command to produce daily summary report files, and the ckpacct command to maintain the integrity of the active data files.

ckpacct

Handles pacct file size. It is advantageous to have several smaller pacct files if you must restart the runacct procedure after a failure in processing these records. The ckpacct command checks the size of the /var/adm/pacct active data file, and if the file is larger than 500 blocks, the command invokes the turnacct switch command to turn off process accounting temporarily. The data is transferred to a new pacct file, /var/adm/pacct x. (x is an integer that increases each time a new pacct file is created.) If the number of free disk blocks falls below 500, the ckpacct command calls the turnacct off command to turn off process accounting.

dodisk

Calls the acctdisk command and either the diskusg command or the acctdusg command to write disk-usage records to the /var/adm/acct/nite/dacct file. This data is later merged into the daily reports.

dodisk

Calls the acctdisk command and either the diskusg command or the acctdusg command to write disk-usage records to the /var/adm/acct/nite/dacct file. This data is later merged into the daily reports.

monacct

Produces a periodic summary from daily reports.

sa1 Collects and stores binary data in the /var/adm/sa/sa dd file, where dd is the day of the month.

sa2 Writes a daily report in the/var/adm/sa/sadd file, where dd is the day of the month. The command removes reports from the /var/adm/sa/sadd file that have been there longer than one week.

Other commands are run automatically by procedures other than the cron daemon:

startup

When added to the /etc/rc file, the startup command initiates startup procedures for the accounting system.

shutacct

Records the time accounting was turned off by calling the acctwtmp command to write a line to /var/adm/wtmp file. It then calls the turnacct off command to turn off process accounting.

Keyboard commands

A member of the adm group can enter the following commands from the keyboard.

ac Prints connect-time records. This command is provided for compatibility with Berkeley Software Distribution (BSD) systems.

acctcom

Displays process accounting summaries. This command is also available to users.

acctcon1

Displays connect-time summaries. Either the -l flag or the -o flag must be used.

accton Turns process accounting on and off.

chargefee

Charges the user a predetermined fee for units of work performed. The charges are added to the daily report by the acctmerg command.

fwtmp

Converts files between binary and ASCII formats.

last Displays information about previous logins. This command is provided for compatibility with BSD systems.

lastcomm

Displays information about the last commands that were executed. This command is provided for compatibility with BSD systems.

lastlogin

Displays the time each user last logged in.

pac Prepares printer/plotter accounting records. This command is provided for compatibility with BSD systems.

prctmp

Displays a session record.

prtacct

Displays total accounting files.

sa Summarizes raw accounting information to help manage large volumes of accounting information. This command is provided for compatibility with BSD systems.

sadc Reports on various local system actions, such as buffer usage, disk and tape I/O activity, TTY device activity counters, and file access counters.

sar Writes to standard output the contents of selected cumulative activity counters in the operating system. The sar command reports only on local activities.

time Prints real time, user time, and system time required to run a command.

timex Reports in seconds the elapsed time, user time, and run time.

Related concepts

System data collection and reporting You can set up the system to automatically collect data and generate reports.

계정 파일

주요 계정 디렉터리는 둘입니다. 계정 시스템을 실행하는 데 필요한 모든 C 언어 프로그램과 셸 프로시저가 있는 /usr/sbin/acct 디렉터리, 그리고 데이터·보고서·요약 파일이 있는 /var/adm 디렉터리입니다.

계정 데이터 파일은 adm 그룹 구성원의 것이며, 모든 활성 데이터 파일(wtmp, pacct 등)은 adm 홈 디렉터리 /var/adm에 있습니다.

계정 데이터 파일

다음 파일은 /var/adm 디렉터리에 있습니다.

파일 설명
/var/adm/diskdiag 디스크 계정 프로그램 실행 중의 진단 출력
/var/adm/dtmp acctdusg 명령의 출력
/var/adm/fee chargefee 명령의 출력(ASCII tacct 레코드)
/var/adm/pacct 활성 프로세스 계정 파일
/var/adm/wtmp 활성 프로세스 계정 파일(원문 그대로. 실제로는 로그인·로그아웃 기록)
/var/adm/Spacct.mmdd runacct 명령 실행 중 mmdd 날짜의 프로세스 계정 파일

계정 보고서와 요약 파일

계정 시스템을 켜기 전에 하위 디렉터리 몇 개가 있어야 합니다.

보고서와 요약 파일은 /var/adm/acct의 하위 디렉터리에 있습니다. 계정 시스템을 켜기 전에 다음 하위 디렉터리를 만들어야 합니다.

디렉터리 내용
/var/adm/acct/nite(x) runacct 명령이 매일 다시 쓰는 파일
/var/adm/acct/sum(x) runacct 명령이 매일 갱신하는 누적 요약 파일
/var/adm/acct/fiscal(x) monacct 명령이 만드는 월간 요약 파일

관련 작업

  • 계정 시스템 설정

계정을 위한 runacct 명령 시작

runacct 명령을 시작할 수 있습니다.

전제 조건

  1. 계정 시스템이 설치돼 있어야 합니다.
  2. root 사용자나 adm 그룹 권한이 있어야 합니다.

참고

  1. 매개변수 없이 runacct 명령을 호출하면 오늘 처음 실행한 것으로 봅니다. 그래서 runacct 프로그램을 다시 시작할 때는 월과 일이 맞도록 mmdd 매개변수를 넣어야 합니다. 상태를 지정하지 않으면 runacct 프로그램은 /var/adm/acct/nite(x)/statefile 파일을 읽어 처리를 시작할 지점을 정합니다. /var/adm/acct/nite(x)/statefile 파일을 무시하려면 명령행에 원하는 상태를 지정합니다.
  2. 다음 작업을 할 때는 간단한 명령 이름 runacct 대신 전체 경로 이름 /usr/sbin/acct/runacct를 써야 할 수 있습니다.

절차

runacct 명령을 시작하려면 다음을 입력합니다.

text
nohup runacct 2> \
/var/adm/acct/nite/accterr &

이렇게 하면 명령이 백그라운드 처리 중 모든 INTR와 QUIT 신호를 무시합니다. 모든 표준 오류 출력은 /var/adm/acct/nite/accterr 파일로 방향이 바뀝니다.

계정을 위한 runacct 명령 다시 시작

runacct 명령이 실패하면 다시 시작할 수 있습니다.

이 절차의 전제 조건은 다음과 같습니다.

  • 계정 시스템이 설치돼 있어야 합니다.
  • root 사용자나 adm 그룹 권한이 있어야 합니다.

참고: runacct 명령이 실패하는 가장 흔한 이유는 다음과 같습니다.

  • 시스템이 다운됩니다.
  • /usr 파일 시스템의 공간이 바닥납니다.
  • /var/adm/wtmp 파일에 날짜 스탬프가 일관되지 않은 레코드가 있습니다.

runacct 명령이 실패하면 다음을 합니다.

  1. /var/adm/acct/nite(x)/activemmdd 파일에서 오류 메시지를 확인합니다.
  2. acct/nite에 active 파일과 lock 파일이 둘 다 있으면, cron 데몬이 runacct 명령을 호출할 때 오류 메시지가 방향을 바꿔 들어가는 accterr 파일을 확인합니다.
  3. 오류를 없애는 데 필요한 조치를 합니다.
  4. runacct 명령을 다시 시작합니다.
  5. 특정 날짜로 runacct 명령을 다시 시작하려면 다음을 입력합니다.
text
nohup runacct 0601 2>> \
/var/adm/acct/nite/accterr &

이렇게 하면 6월 1일(0601)로 runacct 프로그램을 다시 시작합니다. runacct 프로그램은 /var/adm/acct/nite/statefile 파일을 읽어 어느 상태부터 시작할지 알아냅니다. 모든 표준 오류 출력은 /var/adm/acct/nite/accterr 파일에 덧붙습니다. 6. 지정한 상태(예를 들어 MERGE 상태)부터 runacct 프로그램을 다시 시작하려면 다음을 입력합니다.

text
nohup runacct 0601 MERGE 2>> \
/var/adm/acct/nite/accterr &

runacct 명령 파일

runacct 명령은 보고서와 요약 파일을 만듭니다.

runacct 명령이 만드는 다음 보고서와 요약 파일은 특히 눈여겨볼 만합니다.

파일 설명
/var/adm/acct/nite(x)/lineuse 시스템의 터미널 회선마다 사용 통계가 들어 있습니다. 불량 회선을 찾는 데 특히 쓸모 있습니다. 로그아웃과 로그인 수의 비율이 약 3 대 1을 넘으면 회선이 고장 나고 있을 가능성이 큽니다.
/var/adm/acct/nite(x)/daytacct 전날의 총 계정 파일
/var/adm/acct/sum(x)/tacct 날마다의 nite/daytacct 파일을 누적한 것으로, 청구에 쓸 수 있습니다. monacct 명령이 매달 또는 회계 기간마다 이 파일을 새로 시작합니다.
/var/adm/acct/sum(x)/cms 날마다의 명령 요약을 누적한 것. monacct 명령이 이 바이너리 파일을 읽고 비웁니다. ASCII 판은 nite/cms입니다.
/var/adm/acct/sum(x)/daycms 일별 명령 요약. ASCII 판은 nite/daycms에 저장됩니다.
/var/adm/acct/sum(x)/loginlog 사용자 ID마다 마지막으로 쓴 시각의 기록
/var/adm/acct/sum(x)/rprtmmdd runacct 명령이 저장한 일별 보고서 사본

/var/adm/acct/nite(x) 디렉터리의 파일

다음 파일은 /var/adm/acct/nite(x) 디렉터리에 있습니다.

파일 설명
active runacct 명령이 진행 상황을 기록하고 경고·오류 메시지를 출력하는 데 씁니다. active.mmdd 파일은 runacct 프로그램이 오류를 감지한 뒤 만든 active 파일의 사본입니다.
cms prdaily 명령이 쓰는 ASCII 총 명령 요약
ctacct.mmdd 접속 총 계정 레코드
ctmp 접속 세션 레코드
daycms prdaily 명령이 쓰는 ASCII 일별 명령 요약
daytacct 하루치 총 계정 레코드
dacct dodisk 명령이 만드는 디스크 총 계정 레코드
accterr runacct 명령 실행 중에 나온 진단 출력
lastdate runacct가 마지막으로 실행된 날(date +%m%d 형식)
lock1 runacct 명령을 한 번에 하나씩만 쓰도록 제어
lineuse prdaily 명령이 쓰는 tty 회선 사용 보고서
log acctcon1 명령의 진단 출력
logmmdd runacct 명령이 오류를 감지한 뒤의 log와 같음
reboots wtmp의 시작·끝 날짜와 시스템 재시작 목록
statefile runacct 명령 실행 중 현재 상태를 기록
tmpwtmp wtmpfix 명령이 고친 wtmp 파일
wtmperror wtmpfix 오류 메시지
wtmperrmmdd runacct 명령이 오류를 감지한 뒤의 wtmperror와 같음
wtmp.mmdd 전날의 wtmp 파일. runacct 명령의 정리 단계에서 지워집니다.

/var/adm/acct/sum(x) 디렉터리의 파일

다음 파일은 /var/adm/acct/sum(x) 디렉터리에 있습니다.

파일 설명
cms 현재 회계 기간의 총 명령 요약 파일(바이너리 형식)
cmsprev 최신 갱신이 빠진 명령 요약 파일
daycms 전날의 명령 요약 파일(바이너리 형식)
lastlogin lastlogin 명령이 만든 파일
pacct.mmdd mmdd 날짜의 모든 pacct 파일을 이어 붙인 것. 시스템 시작 뒤 remove 명령이 지웁니다(remove 명령은 remove를 봅니다).
rprtmmdd prdaily 명령의 저장된 출력
tacct 현재 회계 기간의 누적 총 계정 파일
tacctprev 최신 갱신이 빠진 tacct
tacctmmdd mmdd 날짜의 총 계정 파일

/var/adm/acct/fiscal(x) 디렉터리의 파일

다음 파일은 /var/adm/acct/fiscal(x) 디렉터리에 있습니다.

파일 설명
cms? ?로 지정한 회계 기간의 총 명령 요약 파일(바이너리 형식)
fiscrpt? ?로 지정한 회계 기간에 대한, prdaily 명령의 출력과 비슷한 보고서(원문은 바이너리 형식이라 적음)
tacct? ?로 지정한 회계 기간의 총 계정 파일(바이너리 형식)

계정 파일 형식

다음 표는 계정 파일 출력과 형식을 요약합니다.

파일 출력과 형식
wtmp 활성 프로세스 계정 파일을 만듭니다. wtmp 파일 형식은 utmp.h 파일에 정의돼 있습니다. utmp.h 파일은 utmp.h를 봅니다.
ctmp 접속 세션 레코드를 만듭니다. 형식은 ctmp.h 파일에 설명돼 있습니다.
pacct* 활성 프로세스 계정 레코드를 만듭니다. 출력 형식은 /usr/include/sys/acct.h 파일에 정의돼 있습니다.
Spacct* runacct 명령 실행 중 mmdd 날짜의 프로세스 계정 파일을 만듭니다. 형식은 sys/acct.h 파일에 정의돼 있습니다.
daytacct 하루치 총 계정 레코드를 만듭니다. 형식은 tacct 파일 형식에 정의돼 있습니다.
sum/tacct 날마다의 명령 요약을 누적하는 바이너리 파일을 만듭니다(원문 그대로). 형식은 /usr/include/sys/acct.h 헤더 파일에 정의돼 있습니다.
ptacct pacct 파일을 이어 붙인 판을 만듭니다. 형식은 tacct 파일에 정의돼 있습니다.
ctacct 접속 총 계정 레코드를 만듭니다. 출력은 tacct 파일에 정의돼 있습니다.
cms prdaily 명령이 쓰는 총 계정 명령 요약을 바이너리 형식으로 만듭니다. ASCII 판은 nite/cms입니다.
daycms prdaily 명령이 쓰는 일별 명령 요약(바이너리 형식). ASCII 판은 nite/daycms입니다.
영어 원문

Accounting files

The two main accounting directories are the /usr/sbin/acct directory, where all the C language programs and shell procedures needed to run the accounting system are stored, and the /var/adm directory, which contains the data, report and summary files.

The accounting data files belong to members of the adm group, and all active data files (such as wtmp and pacct) reside in the adm home directory /var/adm.

Accounting data files

The following files are in the /var/adm directory.

  • /var/adm/diskdiag — Diagnostic output during the running of disk accounting programs
  • /var/adm/dtmp — Output from the acctdusg command
  • /var/adm/fee — Output from the chargefee command, in ASCII tacct records
  • /var/adm/pacct — Active process accounting file
  • /var/adm/wtmp — Active process accounting file
  • /var/adm/Spacct .mmdd — Process accounting files for mmdd during the execution of the runacct command.

Accounting report and summary files

Some subdirectories are needed before you enable the Accounting system.

Report and summary files reside in a /var/adm/acct subdirectory. You must create the following subdirectories before the Accounting system is enabled. /var/adm/acct/nite(x) Contains files that the runacct command reuses daily

/var/adm/acct/sum(x) Contains the cumulative summary files that the runacct command updates daily

/var/adm/acct/fiscal(x) Contains the monthly summary files that the monacct command creates.

Related tasks

Setting up an accounting system You can set up an accounting system.

Starting the runacct command for accounting

You can start the runacct command.

Prerequisites

  1. You must have the accounting system installed.

  2. You must have root user or adm group authority.

Notes

  1. If you call the runacct command with no parameters, the command assumes that this is the first time that the command has been run today. Therefore, you need to include the mmdd parameter when you restart the runacct program, so that the month and day are correct. If you do not specify a state, the runacct program reads the /var/adm/acct/nite(x)/statefile file to determine the entry point for processing. To override the /var/adm/acct/nite(x)/statefile file, specify the desired state on the command line.

  2. When you perform the following task, you might need to use the full path name /usr/sbin/acct/runacct rather than the simple command name, runacct.

Procedure

To start the runacct command, type the following:

text
nohup runacct 2> \
/var/adm/acct/nite/accterr &

This entry causes the command to ignore all INTR and QUIT signals while it performs background processing. It redirects all standard error output to the /var/adm/acct/nite/accterr file.

Restarting the runacct command for Accounting

If the runacct command is unsuccessful, you can restart it.

The prerequisites for this procedure are:

  • You must have the accounting system installed.

  • You must have root user or adm group authority.

Note: The most common reason why the runacct command can fail are because:

  • The system goes down.

  • The /usr file system runs out of space.

  • The /var/adm/wtmp file has records with inconsistent date stamps.

If the runacct command is unsuccessful, do the following:

  1. Check the /var/adm/acct/nite(x)/active mmdd file for error messages.

  2. If both the active file and lock files exist in acct/nite, check the accterr file, where error messages are redirected when the cron daemon calls the runacct command.

  3. Perform any actions needed to eliminate errors.

  4. Restart the runacct command.

  5. To restart the runacct command for a specific date, type the following:

text
nohup runacct 0601 2>> \
/var/adm/acct/nite/accterr &

This restarts the runacct program for June 1 (0601). The runacct program reads the /var/adm/acct/nite/statefile file to find out with which state to begin. All standard error output is appended to the /var/adm/acct/nite/accterr file.

  1. To restart the runacct program at a specified state, for example, the MERGE state, type the following:
text
nohup runacct 0601 MERGE 2>> \
/var/adm/acct/nite/accterr &

runacct command files

The runacct command produces report and summary files.

The following report and summary files, produced by the runacct command, are of particular interest:

  • /var/adm/acct/nite(x)/lineuse — Contains usage statistics for each terminal line on the system. This report is especially useful for detecting bad lines. If the ratio between the number of logouts and logins exceeds about 3 to 1, there is a good possibility that a line is failing.
  • /var/adm/acct/nite(x)/daytacct — Contains the total accounting file for the previous day.
  • /var/adm/acct/sum(x)/tacct — Contains the accumulation of each day's nite/daytacct file and can be used for billing purposes. The monacct command restarts the file each month or fiscal period.
  • /var/adm/acct/sum(x)/cms — Contains the accumulation of each day's command summaries. The monacct command reads this binary version of the file and purges it. The ASCII version is nite/cms.
  • /var/adm/acct/sum(x)/daycms — Contains the daily command summary. An ASCII version is stored in nite/daycms.
  • /var/adm/acct/sum(x)/loginlog — Contains a record of the last time each user ID was used.
  • /var/adm/acct/sum(x)/rprt mmdd — This file contains a copy of the daily report saved by the runacct command.

Files in the /var/adm/acct/nite(x) directory

The following files are in the /var/adm/acct/nite(x) directory.

  • active — Used by the runacct command to record progress and print warning and error messages. The file active. mmdd is a copy of the active file made by the runacct program after it detects an error.
  • cms — ASCII total command summary used by the prdaily command.
  • ctacct.mmdd — Connect total accounting records.
  • ctmp — Connect session records.
  • daycms — ASCII daily command summary used by the prdaily command.
  • daytacct — Total accounting records for one day.
  • dacct — Disk total accounting records, created by the dodisk command.
  • accterr — Diagnostic output produced during the execution of the runacct command.
  • lastdate — Last day the runacct executed, in date +%m%d format.
  • lock1 — Used to control serial use of the runacct command.
  • lineuse — tty line usage report used by the prdaily command.
  • log — Diagnostic output from the acctcon1 command.
  • logmmdd — Same as log after the runacct command detects an error.
  • reboots — Contains beginning and ending dates from wtmp, and a listing of system restarts.
  • statefile — Used to record the current state during execution of the runacct command.
  • tmpwtmp — wtmp file corrected by the wtmpfix command.
  • wtmperror — Contains wtmpfix error messages.
  • wtmperrmmdd — Same as wtmperror after the runacct command detects an error.
  • wtmp.mmdd — Contains previous day's wtmp file. Removed during the cleanup of runacct command.

Files in the /var/adm/acct/sum(x) directory

The following files are in the /var/adm/acct/sum(x) directory.

  • cms — Total command summary file for the current fiscal period, in binary format.
  • cmsprev — Command summary file without the latest update.
  • daycms — Command summary file for the previous day, in binary format.
  • lastlogin — File created by the lastlogin command.
  • pacct.mmdd — Concatenated version of all pacct files for mmdd. This file is removed after system startup by the remove command. For information about the remove command, see remove.
  • rprtmmdd — Saved output of the prdaily command.
  • tacct — Cumulative total accounting file for the current fiscal period.
  • tacctprev — Same as tacct without the latest update.
  • tacctmmdd — Total accounting file for mmdd.

Files in the /var/adm/acct/fiscal(x) directory

The following files are in the /var/adm/acct/fiscal(x) directory.

  • cms? — Total command summary file for the fiscal period, specified by ?, in binary format
  • fiscrpt? — A report similar to that of the prdaily command for fiscal period, specified by ?, in binary format
  • tacct? — Total accounting file for fiscal period, specified by ?, in binary format.

Accounting file formats

The following table summarizes the accounting file output and formats.

  • wtmp — Produces the active process accounting file. The format of the wtmp file is defined in the utmp.h file. For information about the utmp.h file, see utmp.h.
  • ctmp — Produces connect session records. The format is described in the ctmp.h file.
  • pacct* — Produces active process accounting records. The format of the output is defined in the /usr/include/sys/ acct.h file.
  • Spacct* — Produces process accounting files for mmdd during the running of the runacct command. The format of these files is defined in the sys/acct.h file.
  • daytacct — Produces total accounting records for one day. The format of the file is defined in the tacct file format.
  • sum/tacct — Produces binary file that accumulates each day's command summaries. The format of this file is defined in the /usr/include/sys/acct.h header file.
  • ptacct — Produces concatenated versions of pacct files. The format of these files are defined in the tacct file.
  • ctacct — Produces connect total accounting records. The output of this file is defined in the tacct file.
  • cms — Produces total accounting command summary used by the prdaily command, in binary format. The ASCII version is nite/cms.
  • daycms — Daily command summary used by the prdaily command, in binary format. The ASCII version is nite/daycms.