xref: /illumos-gate/usr/src/man/man8/acctsh.8 (revision 1b8ff185254736543b16459758570e86b9f14d93)
te
Copyright 1989 AT&T Copyright (c) 2002 Sun Microsystems, Inc. All Rights Reserved.
The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
ACCTSH 8 "Mar 15, 2002"
NAME
acctsh, chargefee, ckpacct, dodisk, lastlogin, monacct, nulladm, prctmp, prdaily, prtacct, shutacct, startup, turnacct - shell procedures for accounting
SYNOPSIS

/usr/lib/acct/chargefee login-name number

/usr/lib/acct/ckpacct [blocks]

/usr/lib/acct/dodisk [-o] [filename]...

/usr/lib/acct/lastlogin

/usr/lib/acct/monacct number

/usr/lib/acct/nulladm filename...

/usr/lib/acct/prctmp filename

/usr/lib/acct/prdaily [-c] [-l] [mmdd]

/usr/lib/acct/prtacct filename ['' heading '']

/usr/lib/acct/shutacct ['' reason '']

/usr/lib/acct/startup

/usr/lib/acct/turnacct on | off | switch
DESCRIPTION
"chargefee Command"

chargefee can be invoked to charge a number of units to login-name. A record is written to /var/adm/fee, to be merged with other accounting records by runacct(8).

"ckpacct Command"

ckpacct should be initiated using cron(8) to periodically check the size of /var/adm/pacct. If the size exceeds blocks, 500 by default, turnacct will be invoked with argument switch. To avoid a conflict with turnacct switch execution in runacct, do not run ckpacct and runacct simultaneously. If the number of free disk blocks in the /var file system falls below 500, ckpacct will automatically turn off the collection of process accounting records via the off argument to turnacct. When at least 500 blocks are restored, the accounting will be activated again on the next invocation of ckpacct. This feature is sensitive to the frequency at which ckpacct is executed, usually by the cron(8) command.

"dodisk Command"

dodisk should be invoked by cron(8) to perform the disk accounting functions.

"lastlogin Command"

lastlogin is invoked by runacct(8) to update /var/adm/acct/sum/loginlog, which shows the last date on which each person logged in.

"monacct Command"

monacct should be invoked once each month or each accounting period. number indicates which month or period it is. If number is not given, it defaults to the current month (01-12). This default is useful if monacct is to executed using cron(8) on the first day of each month. monacct creates summary files in /var/adm/acct/fiscal and restarts the summary files in /var/adm/acct/sum.

"nulladm Command"

nulladm creates filename with mode 664 and ensures that owner and group are adm. It is called by various accounting shell procedures.

"prctmp Command"

prctmp can be used to print the session record file (normally /var/adm/acct/nite/ctmp created by acctcon1 (see acctcon(8)).

"prdaily Command"

prdaily is invoked by runacct(8) to format a report of the previous day's accounting data. The report resides in /var/adm/acct/sum/rprt/mmdd where mmdd is the month and day of the report. The current daily accounting reports may be printed by typing prdaily. Previous days' accounting reports can be printed by using the mmdd option and specifying the exact report date desired.

"prtacct Command"

prtacct can be used to format and print any total accounting (tacct)file.

"shutacct Command"

shutacct is invoked during a system shutdown to turn process accounting off and append a reason record to /var/adm/wtmpx.

"startup Command"

startup can be invoked when the system is brought to a multi-user state to turn process accounting on.

"turnacct Command"

turnacct is an interface to accton (see acct(8)) to turn process accounting on or off. The switch argument moves the current /var/adm/pacct to the next free name in /var/adm/pacct.incr (where incr is a number starting with 0 and incrementing by one for each additional pacct file), then turns accounting back on again. This procedure is called by ckpacct and thus can be taken care of by the cron(8) command and used to keep pacct to a reasonable size. shutacct uses turnacct to stop process accounting. startup uses turnacct to start process accounting.

OPTIONS

The following options are supported: -c

This option prints a report of exceptional resource usage by command, and may be used on current day's accounting data only.

-l

This option prints a report of exceptional usage by login id for the specified date. Previous daily reports are cleaned up and therefore inaccessible after each invocation of monacct.

-o

This option uses acctdusg (see acct(8)) to do a slower version of disk accounting by login directory. filenames specifies the one or more filesystem names where disk accounting will be done. If filenames are used, disk accounting will be done on these filesystems only. If the -o option is used, filenames should be mount points of mounted filesystems. If the -o option is omitted, filenames should be the special file names of mountable filesystems.

FILES
/etc/logadm.conf

Configuration file for the logadm(8) command

/usr/lib/acct

Holds all accounting commands listed in section 8 of this manual

/usr/lib/acct/ptecms.awk

Contains the limits for exceptional usage by command name

/usr/lib/acct/ptelus.awk

Contains the limits for exceptional usage by login ID

/var/adm/acct/fiscal

Fiscal reports directory

/var/adm/acct/nite

Working directory

/var/adm/acct/sum

Summary directory that contains information for monacct

/var/adm/acct/sum/loginlog

File updated by last login

/var/adm/fee

Accumulator for fees

/var/adm/pacct

Current file for per-process accounting

/var/adm/pacctincr

Used if pacct gets large and during execution of daily accounting procedure

/var/adm/wtmpx

History of user access and administration information

SEE ALSO

acctcom (1), acct (2), acct.h (3HEAD), utmpx (5), attributes (7), acct (8), acctcms (8), acctcon (8), acctmerg (8), acctprc (8), cron (8), fwtmp (8), logadm (8), runacct (8)

NOTES

See runacct(8) for the main daily accounting shell script, which performs the accumulation of connect, process, fee, and disk accounting on a daily basis. It also creates summaries of command usage.