*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->Tru64 Unix man pages -> prtacct (8)              
Title
Content
Arch
Section
 

acct(8)

Contents


NAME    [Toc]    [Back]

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

SYNOPSIS    [Toc]    [Back]

       chargefee User  Number

       ckpacct [BlockSize]

       dodisk [-o] [File...]

       lastlogin

       monacct [Number]

       nulladm [File...]

       prctmp File...

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

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

       remove

       shutacct  ['Reason']

       startup

       turnacct on | off | switch

DESCRIPTION    [Toc]    [Back]

       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 system 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 commands 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 files.

       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: 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 accounting records with
       the  acctmerg  command  to  create  a  daily  /var/adm/fee
       report.

              The  chargefee  command uses the printpw command to
              get the list of all users stored  in  the  password
              database.  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 superuser
  (root)  and  to adm in case of an error.  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: 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 procedure, 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.
              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 command
 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  processed.
  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  summaries  are
              appended.   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.   The system administrator may
              use the prctmp command to output the session record
              file  specified by File and created by the acctcon1
              command      (this      is       normally       the
              /var/adm/acct/nite/ctmp file).  The prdaily command
              is invoked from the runacct shell procedure to format
  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: Reports
              exceptional resource usage by command. May be  used
              only  on  accounting  records  for the current day.
              Reports exceptional usage by login ID for the specified
  date.   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:
              Selects  type tacct structure members to be output,
              using  the  structure-member  selection   mechanism
              specified  for the acctmerg command.  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.  User ID.  A  field  for
              the  login  name with the same number of characters
              NSZ as the ut_user member of  the  utmp  structure.
              Cumulative  CPU time in minutes.  Cumulative K-core
              time in minutes.  Cumulative number  of  characters
              transferred  in  blocks  of  512 bytes.  Cumulative
              number of blocks read and written.  Cumulative connect
  time  in minutes.  Cumulative disk-usage time
              in minutes.  Queuing system (printer) fee in number
              of pages.  Special services fee expressed in units.
              A count of the number of processes.  A count of the
              number of login sessions.  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.
              The  shutacct  command turns process accounting off
              and adds a 'Reason'  record  to  the  /var/adm/wtmp
              file. This command is usually invoked during 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.  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: Turns process  accounting
  on.  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 restarted.

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






NOTES    [Toc]    [Back]

       You should not share accounting files  among  nodes  in  a
       distributed  environment.   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   information   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 command).

EXAMPLES    [Toc]    [Back]

       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 command is subsequently instructed  to
              merge  with  records  in  other accounting files to
              produce the daily report.  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.
              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 daemon 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.  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
              instructions  normally  passed  to  the cron daemon
              from the /usr/spool/cron/crontabs/adm shell  script
              file.   See  the  System  Administration manual for
              details.  To turn on the accounting functions  when
              the  system is started up, add the following to the
              /etc/rc.config file: ACCOUNTING="YES"

              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.

FILES    [Toc]    [Back]

       Specifies the command path.  Header files defining  structures
  used  to  organize accounting information.  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  name.
       Working  directory that contains daily accounting database
       files.  Contains information about file systems.   Working
       subdirectory  that  contains  accounting  summary database
       files.

SEE ALSO    [Toc]    [Back]

      
      
       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



                                                          acct(8)
[ Back ]
 Similar pages
Name OS Title
closewtmp HP-UX overview of accounting and miscellaneous accounting commands
acct IRIX overview of accounting and miscellaneous accounting commands
utmp2wtmp HP-UX overview of accounting and miscellaneous accounting commands
acctdisk HP-UX overview of accounting and miscellaneous accounting commands
accton HP-UX overview of accounting and miscellaneous accounting commands
acct HP-UX overview of accounting and miscellaneous accounting commands
acctwtmp HP-UX overview of accounting and miscellaneous accounting commands
acctdusg HP-UX overview of accounting and miscellaneous accounting commands
rc.subr FreeBSD functions used by system shell scripts
whiptail Linux display dialog boxes from shell scripts
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service