Produces command-usage summaries from accounting records.
The acctcms command reads each file specified by the File parameter, adds and sorts all records for identically named processes, and writes the records to standard output. By default, the output file is in binary format. Input files are usually in the acct file format.
When you use the -o and -p flags together, the acctcms command produces a report that combines prime and nonprime time. Prime and nonprime times are defined by entries in the /etc/acct/holidays file. Prime times are assumed to be the period when the system is most active, such as weekdays. Saturdays and Sundays are always nonprime time for the accounting systems, as are any holidays that you specify in the /etc/acct/holidays file. All the output summaries are of total usage, except for number of times run, CPU minutes, and real minutes, which are split into prime and nonprime minutes.
Item | Description |
---|---|
-a | Displays output in ASCII summary format rather than binary
summary format. Each output line contains the command name, the number
of times the command was run, total kcore time (memory measurement
in kilobyte segments), total CPU time, total real time, mean memory
size (in K-bytes), mean CPU time per invocation of the command, and
the CPU usage factor. The listed times are all in minutes. The acctcms command
normally sorts its output by total kcore minutes. The unit kcore minutes
is a measure of the amount of memory used (in kilobytes) multiplied
by the amount of time it was in use. This flag cannot be used with
the -t flag. Use the following options only with the -a
option:
The default items have the following headings in the output:
|
-c | Sorts by total CPU time rather than total kcore minutes. When this flag is used with the -n flag, only the -n flag takes effect. |
-j | Combines all commands called only once under the heading other. |
-n | Sorts by the number of times the commands were called. When this flag is used with the -c flag, only the -n flag takes effect. |
-o | Displays a command summary of nonprime time commands. You can use this flag only when the -a flag is used. |
-p | Displays a command summary of prime time commands. You can use this flag only when the -a flag is used. |
-s | Assumes that any named files that follow this flag are already in binary format. |
-t | Processes all records as total accounting records. The default binary format splits each field into prime and nonprime time sections. This option combines the prime and non-prime time parts into a single field that is the total of both, and provides upward compatibility with old style acctcms binary summary format records. This flag cannot be used with the -a flag. |
Access Control: This command should grant execute (x) access only to members of the adm group.
To collect daily command accounting records in a today file and maintain a running total in a total file, add the following to a shell script:
acctcms File . . . > today
cp total previoustotal
acctcms -s today previoustotal > total
acctcms -a -s total
The File parameters that you specify are redirected to a file called today, added to the previous total (in a file renamed previoustotal) to produce a new total (called total). All files are binary files. In the last line, the -a flag displays the total file in ASCII format so you can view the report.
Item | Description |
---|---|
/etc/acct/holidays | Specifies prime and nonprime time for accounting records. |
/usr/sbin/acct/acctcms | Contains the acctcms command. |