Setting up an accounting system
You can set up an accounting system.
The information below is an overview of the steps you must take to set up an accounting system. Refer to the commands and files noted in these steps for more specific information.
- Use the nulladm command
to ensure that each file has the correct access permission: read (r)
and write (w) permission for the file owner and group and read (r)
permission for others by typing:
/usr/sbin/acct/nulladm wtmp pacct
This provides access to the pacct and wtmp files. - Update the /etc/acct/holidays file
to include the hours you designate as prime time and to reflect your
holiday schedule for the year. Note: Comment lines can appear anywhere in the file as long as the first character in the line is an asterisk (*).
- To define prime time, fill in the fields on the first data line
(the first line that is not a comment), using a 24-hour clock. This
line consists of three 4-digit fields, in the following order:
- Current year
- Beginning of prime time (hhmm)
- End of prime time (hhmm)
For example, to specify the year 2000, with prime time beginning at 8:00 a.m. and ending at 5:00 p.m., enter:2000 0800 1700
- To define the company holidays for the yea, fill in the next data
line. Each line contains four fields, in the following order:
- Day of the year
- Month
- Day of the month
- Description of holiday
A two-line example follows:1 Jan 1 New Year's Day 332 Nov 28 Thanksgiving Day
- To define prime time, fill in the fields on the first data line
(the first line that is not a comment), using a 24-hour clock. This
line consists of three 4-digit fields, in the following order:
- Turn on process accounting by adding the following line
to the /etc/rc file or by deleting the comment
symbol (#) in front of the line if it exists:
/usr/bin/su - adm -c /usr/sbin/acct/startup
The startup procedure records the time that accounting was turned on and cleans up the previous day's accounting files. - Identify each file system you want included in disk accounting
by adding the following line to the stanza for the file system in
the /etc/filesystems file:
account = true
- Specify the data file to use for printer data by adding
the following line to the queue stanza in the /etc/qconfig file:
acctfile = /var/adm/qacct
- As the adm user, create a /var/adm/acct/nite,
a /var/adm/acct/fiscal, a and /var/adm/acct/sum directory
to collect daily and fiscal period records:
su - adm cd /var/adm/acct mkdir nite fiscal sum exit
For long usernames, use the following commands instead:
su - adm cd /var/adm/acct mkdir nitex fiscalx sumx exit
- Set daily accounting procedures to run automatically by
editing the /var/spool/cron/crontabs/adm file
to include the dodisk, ckpacct, and runacct commands.
For example:
0 2 * * 4 /usr/sbin/acct/dodisk 5 * * * * /usr/sbin/acct/ckpacct 0 4 * * 1-6 /usr/sbin/acct/runacct 2>/var/adm/acct/nite/accterr
For long usernames, add the following lines instead:0 2 * * 4 /usr/sbin/acct/dodisk -X 5 * * * * /usr/sbin/acct/ckpacct 0 4 * * 1-6 /usr/sbin/acct/runacct -X 2>/var/adm/acct/nitex/accterr
The first line starts disk accounting at 2:00 a.m. (
0 2
) each Thursday (4). The second line starts a check of the integrity of the active data files at 5 minutes past each hour (5 *
) every day (*
). The third line runs most accounting procedures and processes active data files at 4:00 a.m. (0 4
) every Monday through Saturday (1-6
). If these times do not fit the hours your system operates, adjust your entries.Note: You must have root user authority to edit the /var/spool/cron/crontabs/adm file. - Set the monthly accounting summary to run automatically by including the monacct
command in the /var/spool/cron/crontabs/adm file.
For example, type:
15 5 1 * * /usr/sbin/acct/monacct
For long usernames, add the following line instead:15 5 1 * * /usr/sbin/acct/monacct -X
Be sure to schedule this procedure early enough to finish the report. This example starts the procedure at 5:15 a.m. on the first day of each month.
- To submit the edited cron file,
type:
crontab /var/spool/cron/crontabs/adm