Switch to SpeakEasy.net DSL

The Modular Manual Browser

Home Page
Manual: (OSF1-V5.1-alpha)
Apropos / Subsearch:
optional field

acct(8)								      acct(8)


  acct,	chargefee, ckpacct, dodisk, lastlogin, monacct,	nulladm, prctmp,
  prdaily, prtacct, remove, shutacct, startup, turnacct	- Provide accounting
  commands for shell scripts


  chargefee User  Number

  ckpacct [BlockSize]

  dodisk [-o] [File...]


  monacct [Number]

  nulladm [File...]

  prctmp File...

  prdaily [[-l]	[mmdd]]	| [-c]

  prtacct [-f Specification] [-v] File ['Heading']


  shutacct  ['Reason']


  turnacct on |	off | switch


  There	are a number of	commands in the	/usr/sbin/acct directory that, along
  with other accounting	commands, enable you to	produce	a wide range of	sys-
  tem accounting records and files.  For example, the runacct script invokes
  some accounting commands and enables you to produce daily accounting
  records and files.  Some of the commands in the acct directory are invoked
  when active accounting files become too large, and other commands can	be
  used by a system administrator to perform periodic accounting	operations.

  Daily	and monthly accounting reports can be produced by specifying commands
  in the /usr/var/spool/cron/crontabs directory, which are processed by	the
  cron daemon.	These accounting reports consist of a collection of records
  that are produced at the end of any process and on a daily and monthly
  periodic basis.

  You can specify a prime-time period for any 24-hour weekday. Prime-time
  hours	are those contiguous hours of a	weekday	for which premium fees might
  be charged for resource use. Nonprime-time hours are those contiguous	hours
  that are not defined as prime	time. Nonprime time also includes weekends
  and any holidays listed in the file /usr/sbin/acct/holidays.

  When you set up accounting, you can include entries in the
  /usr/spool/cron/crontabs/adm file to run the following accounting commands:

      The ckpacct command checks the size of the /var/adm/pacct	process
      accounting files.

      The runacct command includes other accounting shell scripts and com-
      mands and	creates	daily and monthly accounting files.

      The monacct command produces monthly summary accounting files in the
      /var/adm/acct/fiscal accounting subdirectory from	the daily accounting

  In addition, you can include the dodisk command in the
  /usr/spool/cron/crontabs/root	file.  The dodisk command creates disk usage
  accounting records.

  The accounting commands are as follows:

  chargefee User Number
      The chargefee command is used by the system administrator	to charge the
      number of	units specified	by the Number operand to the login name
      specified	by the User operand. The Number	value may be an	integer	or a
      decimal value. The chargefee command writes a record to the
      /var/adm/fee file. This information is then merged with other account-
      ing records with the acctmerg command to create a	daily /var/adm/fee

      The chargefee command uses the printpw command to	get the	list of	all
      users stored in the password database.

  ckpacct [BlockSize]
      The ckpacct command is used to check the size of the active process
      accounting file, /var/adm/pacct.	Normally, the cron daemon processes
      this command from	the crontabs file. When	the size of the	active data
      files exceeds the	number of blocks specified by the BlockSize operand,
      the ckpacct command is used to invoke the	turnacct switch	command	to
      turn off process accounting.  The	default	value for the BlockSize
      operand is 500.

      When the number of free disk blocks in the var file system falls below
      500, the ckpacct command is used to inhibit process accounting by
      invoking the turnacct off	command.  When at least	500 free disk blocks
      are again	available, account processing is reactivated. This feature is
      sensitive	to how frequently ckpacct is run.

      When the environment variable MAILCOM is set to mail root	adm, a mail
      message is sent to the super-user	(root) and to adm in case of an

  dodisk  [-o] [File ....]
      The dodisk command initiates disk-usage accounting by calling the
      diskusg command and the acctdisk command.

      When you specify the -o option with the dodisk command, a	more thorough
      but slower version of disk accounting by login directory is initiated
      with the acctdusg	command.  Normally, the	cron daemon runs the dodisk
      command. The following option may	be used	with the dodisk	command:

  -o  Calls the	acctdusg command instead of the	diskusg	command	to initiate
      disk accounting by login directory.

      By default, the dodisk command does disk accounting on special files
      recorded in the <filename> /etc/fstab</filename> file. But when you
      specify file names with the File operand,	disk accounting	is done	on
      only those files.

      When you do not specify the -o option, the File operand should specify
      special file names of mountable file systems. When you specify both -o
      and one or more File(s), File(s) should specify mount points of mounted
      file systems.

      The lastlogin command updates the	/var/adm/acct/sum/loginlog file	to
      show the last date each user logged in. Normally,	the runacct pro-
      cedure, running under the	cron daemon, calls this	command	and adds the
      information to the daily report; however,	the lastlogin command can
      also be entered by the system administrator.  The	lastlogin command
      uses the printpw command to get a	list of	all users whose	name and user
      ID are stored in the password database file.

  monacct [Number]
      The monacct command collects daily or other periodic accounting records
      into summary files in the	/var/adm/acct/fiscal subdirectory. After
      monthly summary files are	produced, monacct removes the old accounting
      files from the /var/adm/acct/sum subdirectory and	replaces them with
      the newly	created	summary	files. The cron	daemon should run this com-
      mand once	each month on the first	day of the following month or some
      other specified day after	all the	dailies	have been produced. (The
      monacct example shows how	to enter this command for the cron daemon.)

      The Number operand is a numerical	value in the range 1 < n < 12 (where
      n	is the month) that indicates the month for which daily files are pro-
      cessed. The default value	used for the Number operand is the current
      month. The monacct command stores	the newly created summary files	in
      the /var/adm/acct/fiscal subdirectory and	restarts new summary files in
      /var/adm/acct/sum, the cumulative	summaries to which daily record	sum-
      maries are appended.

  nulladm  [File ....]
      The nulladm command creates the file specified in	the File operand,
      gives read (r) and write (w) permissions to the file owner and group,
      read (r) permission to other users, and ensures that the file owner and
      group is adm. Various accounting shell procedures	invoke the nulladm
      command.	The system administrator uses this command to set up active
      data files, such as the /var/adm/wtmp file.

  prctmp File ....
      The system administrator may use the prctmp command to output the	ses-
      sion record file specified by File and created by	the acctcon1 command
      (this is normally	the /var/adm/acct/nite/ctmp file).

  prdaily [[-l]	[mmdd]]	| [-c]
      The prdaily command is invoked from the runacct shell procedure to for-
      mat an ASCII file	of the accounting data of the previous day.  The
      records making up	this file are located in the
      /var/adm/acct/sum/rprtmmdd files,	where mmdd is the month	and day	for
      which the	file is	produced. Use the mmdd operand to specify a date
      other than the current day. The following	options	may be used with the
      prdaily command:

  -c  Reports exceptional resource usage by command. May be used only on
      accounting records for the current day.

  -l [mmdd]
      Reports exceptional usage	by login ID for	the specified date.

  prtacct [-f Specification] [-v] File ['Heading']
      The prtacct command formats and displays any total accounting file
      specified	by the File operand; records for these files are defined by a
      type tacct structure in the tacct.h include file.	 You can enter the
      prtacct command to output	any tacct file to the default output device.
      For example, you may output a daily report keyed to connect time,	to
      process time, to disk usage, and to printer usage. To specify a title
      for the report, specify a	name for the Heading operand with enclosed
      single or	double quotes. The following options may be used with the
      prtacct command:

  -f Specification
      Selects type tacct structure members to be output, using the
      structure-member selection mechanism specified for the acctmerg com-

  -v  Produces verbose output in which more precise notation is	used for
      floating-point numbers.

      Specifies	a heading for report members.

      The type tacct structure defines a total accounting record format,
      parts of which are used by various accounting commands. Members of the
      type tacct structure whose data types are	specified as an	array of two
      double elements have both	prime-time and nonprime-time values. The type
      tacct structure has the following	members.

  uid_t	ta_uid
      User ID.

  char ta_name[NSZ]
      A	field for the login name with the same number of characters NSZ	as
      the ut_user member of the	utmp structure.

  double ta_cpu[2]
      Cumulative CPU time in minutes.

  double ta_kcore[2]
      Cumulative K-core	time in	minutes.

  double ta_io[2]
      Cumulative number	of characters transferred in blocks of 512 bytes.

  double ta_rw[2]
      Cumulative number	of blocks read and written.

  double ta_con[2]
      Cumulative connect time in minutes.

  double ta_du
      Cumulative disk-usage time in minutes.

  long ta_qsys
      Queuing system (printer) fee in number of	pages.

  double ta_fee
      Special services fee expressed in	units.

  long ta_pc
      A	count of the number of processes.

  unsigned short ta_sc
      A	count of the number of login sessions.

  unsigned short ta_dc
      A	count of the number of disk samples.

      The remove command deletes all<filename>
      /var/adm/acct/sum/wtmp*</filename>, /var/adm/acct/sum/pacct*, and
      /var/adm/acct/nite/lock* files as	part of	the daily cleanup procedure
      called by	the runacct command.

  shutacct  ['Reason']
      The shutacct command turns process accounting off	and adds a 'Reason'
      record to	the /var/adm/wtmp file.	This command is	usually	invoked	dur-
      ing a system shutdown.

      The startup command turns	on the accounting functions and	adds a reason
      record to	the /var/adm/wtmp file.	 Usually the startup command is
      invoked by the /sbin/init.d/acct script when the system is started up.

  turnacct on |	off | switch
      The turnacct command provides an interface to the	accton command to
      turn process accounting on or off, or to create a	new /var/adm/pacctn
      process accounting file. This command can	 be executed only by a
      superuser	or by the adm login name. Only one of the arguments on,	off,
      or switch	may be used:

  on  Turns process accounting on.

  off Turns process accounting off.

      The switch option	is used	to create a new	/var/adm/pacctn	file when the
      current /var/adm/pacctn file is too large. The suffix n (where n is a
      positive integer)	indicates the previous active /var/adm/pacctn file.
      After the	currently active /var/adm/pacctn file is renamed, a new
      active /var/adm/pacct file is created and	process	accounting is res-

      This command is usually called by	the ckpacct command, running under
      the cron daemon, to keep the active pacct	data file down to a manage-
      able size.


  You should not share accounting files	among nodes in a distributed environ-
  ment.	 Each node should have its own copy of the various accounting files.

  When you are also using the sa command, sa does not know whether informa-
  tion is stored in the	incremental /var/adm/pacctn file or in any other
  /var/adm/pacctn summary file by the acct/* commands (see the turnacct	com-


   1.  To charge smith for 10 units of work on a financial report, enter:
	    /usr/sbin/acct/chargefee smith 10

       A record	is created in the /var/adm/fee file, which the acctmerg	com-
       mand is subsequently instructed to merge	with records in	other
       accounting files	to produce the daily report.

   2.  To check	the size of a /var/adm/pacctn summary accounting file, add
       the following instruction to the	/usr/spool/cron/crontabs/adm file:
	    5 *	* * * /usr/sbin/acct/ckpacct

       This example shows another instruction that the cron daemon reads and
       acts upon when it is included in	the /usr/spool/cron/crontabs/adm
       shell script file.  The ckpacct command is set to run at	5 minutes
       past every hour (5 *) every day.	This command is	only one of many
       accounting instructions normally	passed to the cron daemon from the
       /usr/spool/cron/crontabs/adm shell script file.	See the	System
       Administration manual for details.

   3.  To initiate disk-usage accounting, add the following to the
       /usr/spool/cron/crontabs/root file:
	    0 2	* * 4 /usr/sbin/acct/dodisk

       This example illustrates	a shell	script instruction that	the cron dae-
       mon reads and then processes. The dodisk	command	runs at	2 a.m. (0 2)
       each Thursday (4). This command is one of many accounting instructions
       normally	passed to the cron daemon from a /usr/spool/cron/crontabs/adm
       shell script file. See the System Administration	manual for details.

   4.  To produce a monthly accounting report, at the beginning	of each
       month, add the following	instruction to the
       /usr/spool/cron/crontabs/adm file:
	    15 5 1 * * /usr/sbin/acct/monacct

       This example is an instruction that the cron daemon reads and then
       processes. The monacct command runs at 5:15 (15 5) the first day	of
       each month (1). This command is only one	of many	accounting instruc-
       tions normally passed to	the cron daemon	from the
       /usr/spool/cron/crontabs/adm shell script file.	See the	System
       Administration manual for details.

   5.  To turn on the accounting functions when	the system is started up, add
       the following to	the /etc/rc.config file:

       To set the variable, use	the following rcmgr command:
	    rcmgr set ACCOUNTING YES

       The startup shell procedure records the time and	cleans up the records
       produced	the previous day.


      Specifies	the command path.

  /usr/include/sys/acct.h, /usr/include/utmp.h
      Header files defining structures used to organize	accounting informa-

      Accumulates the fees charged to each login name.

      Current database file for	process	accounting information.

      Another process accounting database file,	which is produced when the
      /var/adm/pacct file gets too large.

      Login/logout database file.

      Shell procedure that calculates limits for exceptional usage by the
      login ID.

      Shell procedure that calculates limits of	exceptional usage by command

      Working directory	that contains daily accounting database	files.

      Contains information about file systems.

      Working subdirectory that	contains accounting summary database files.


  Commands: acctcms(8),	acctcom(8), acctcon(8),	acctmerg(8), acctprc(8),
  cron(8), fwtmp(8), printpw(8), runacct(8), rcmgr(8), wtmpconvert(8)

  Functions: acct(2)

  System Administration