ACCTSH(8) — MAINTENANCE COMMANDS
NAME
chargefee, ckpacct, dodisk, lastlogin, monacct, nulladm, prctmp, prdaily, prtacct, runacct, 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 [ −cl ] [ mmdd ]
/usr/lib/acct/prtacct filename [ heading ]
/usr/lib/acct/runacct [ mmdd ] [ mmdd state ]
/usr/lib/acct/shutacct [ reason ]
/usr/lib/acct/startup
/usr/lib/acct/turnacct on|off|switch
DESCRIPTION
chargefee
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 during the night.
ckpacct
ckpacct should be initiated by cron(8) every hour. It periodically checks the size of /var/adm/pacct. If the size exceeds blocks, 1000 by default, turnacct is called with the argument switch. If the number of free disk blocks in the /usr file system falls below 500, ckpacct automatically turns off the collection of process accounting records using the off argument to turnacct. When at least this number of blocks is restored, accounting is activated again. This feature is sensitive to the frequency at which ckpacct is executed, usually by cron.
dodisk
dodisk should be executed by cron to perform the disk accounting functions. By default, it does disk accounting on the 4.2 file systems in /etc/fstab. filenames specify 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. They should be the special file names of mountable filesystems.
lastlogin
lastlogin is invoked by runacct to update /var/adm/acct/sum/loginlog, which shows the last date on which each person logged in. lastlogin deletes the entries of users no longer in /etc/passwd and creates new entries.
monacct
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 executed by cron(8) on the first day of each month. monacct creates summary files in /var/adm/acct/fiscal and restarts summary files in /var/adm/acct/sum.
nulladm
nulladm creates filename with mode 664 and insures that owner and group are adm. It is called by various accounting shell procedures.
prctmp
prctmp can be used to print the session record file with headings (normally /var/adm/acct/nite/ctmp created by acctcon1 (see acctcon(8)). The heading specifies device, user ID, login name, prime connect time (in seconds), non-prime connect time (in seconds), session starting time (numeric) and starting date and time.
prdaily
prdaily is invoked by runacct to format a report of the previous day’s accounting data. The report resides in /var/adm/acct/sum/rprtmmdd 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. Previous daily reports are cleaned up and therefore inaccessible after each invocation of monacct.
prtacct
prtacct can be used to format and print any total accounting (tacct) file with headings. See Chapter 8 in the System and Network Administration manual, for an explanation of this output.
runacct
runacct performs the accumulation of connect, process, fee, and disk accounting on a daily basis. It also creates summaries of command usage. For more information, see runacct(8).
shutacct
shutacct should be invoked during a system shutdown (usually in /etc/shutdown) to turn process accounting off and append a “reason” record to /var/adm/wtmp. If reason is not specified, shutdown is provided as a default reason.
startup
startup should be called by /etc/rc to turn the accounting on whenever the system is brought up.
turnacct
turnacct is an interface to accton (see acct(8)) to turn process accounting on or off. The switch argument turns accounting off, moves the current /var/adm/pacct to the next free name in /var/adm/pacctincr (where incr is a number starting with 1 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 cron and used to keep pacct to a reasonable size. This command is restricted to the super-user.
OPTIONS
dodisk
−o Do a slower version of disk accounting by login directory. filenames should be mount points of mounted filesystem.
prdaily
−c Prints a report of exceptional resource usage by command. This may be used on current day’s accounting data only.
−l Print a report of exceptional usage by login ID for the specifed date.
FILES
/etc/fstab list of file systems /var/adm/fee accumulator for fees
/var/adm/pacct current file for per-process accounting
/var/adm/pacct∗ used if pacct gets large and during execution of daily accounting procedure
/var/adm/wtmp login/logoff summary
/usr/lib/acct/ptelus.awk
limits for exceptional usage by login id
/usr/lib/acct/ptecms.awk
limits for exceptional usage by command name
/var/adm/acct/nite working directory
/usr/lib/acct directory of accounting commands
/var/adm/acct/sum summary directory, should be saved
SEE ALSO
acctcom(1), acct(2V), acct(5), utmp(5V), acct(8), acctcms(8), acctcon(8), acctmerg(8), acctprc(8), cron(8), diskusg(8), fwtmp(8), runacct(8)
System and Network Administration
Sun Release 4.1 — Last change: 17 January 1990