1994-09-26 22:12:27 +00:00
|
|
|
.\"
|
|
|
|
.\" Copyright (c) 1994 Simon J. Gerraty
|
|
|
|
.\" Copyright (c) 1994 Christopher G. Demetriou
|
|
|
|
.\" All rights reserved.
|
1994-05-26 05:23:31 +00:00
|
|
|
.\"
|
|
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
|
|
.\" modification, are permitted provided that the following conditions
|
|
|
|
.\" are met:
|
|
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
|
|
.\" documentation and/or other materials provided with the distribution.
|
|
|
|
.\"
|
1994-09-26 22:12:27 +00:00
|
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
|
|
.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
|
|
.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
|
|
.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
|
|
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
|
|
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
1994-05-26 05:23:31 +00:00
|
|
|
.\"
|
2020-02-19 12:49:49 +00:00
|
|
|
.Dd February 14, 2020
|
1994-05-26 05:23:31 +00:00
|
|
|
.Dt AC 8
|
1994-09-26 22:12:27 +00:00
|
|
|
.Os
|
1994-05-26 05:23:31 +00:00
|
|
|
.Sh NAME
|
|
|
|
.Nm ac
|
1994-09-26 22:12:27 +00:00
|
|
|
.Nd connect time accounting
|
1994-05-26 05:23:31 +00:00
|
|
|
.Sh SYNOPSIS
|
2000-11-20 20:10:44 +00:00
|
|
|
.Nm
|
1994-09-26 22:12:27 +00:00
|
|
|
.Op Fl dp
|
|
|
|
.\".Op Fl c Ar console
|
|
|
|
.Op Fl t Ar tty
|
|
|
|
.Op Fl w Ar wtmp
|
1994-05-26 05:23:31 +00:00
|
|
|
.Op Ar users ...
|
|
|
|
.Sh DESCRIPTION
|
2001-07-15 08:06:20 +00:00
|
|
|
If the file
|
2010-01-21 17:25:12 +00:00
|
|
|
.Pa /var/log/utx.log
|
1994-09-26 22:12:27 +00:00
|
|
|
exists, a record of individual login and logout
|
|
|
|
times are written to it by
|
1996-04-07 00:06:21 +00:00
|
|
|
.Xr login 1
|
1994-09-26 22:12:27 +00:00
|
|
|
and
|
|
|
|
.Xr init 8 ,
|
1994-05-26 05:23:31 +00:00
|
|
|
respectively.
|
2002-07-14 14:47:15 +00:00
|
|
|
The
|
|
|
|
.Nm
|
|
|
|
utility
|
1995-10-07 12:02:33 +00:00
|
|
|
examines these records and writes the accumulated connect time (in hours)
|
1994-09-26 22:12:27 +00:00
|
|
|
for all logins to the standard output.
|
1994-05-26 05:23:31 +00:00
|
|
|
.Pp
|
1994-09-26 22:12:27 +00:00
|
|
|
The options are as follows:
|
|
|
|
.Bl -tag -width indentXXX
|
1994-05-26 05:23:31 +00:00
|
|
|
.It Fl d
|
|
|
|
Display the connect times in 24 hour chunks.
|
1994-09-26 22:12:27 +00:00
|
|
|
.\" .It Fl c Ar console
|
2001-07-15 08:06:20 +00:00
|
|
|
.\" Use
|
1994-09-26 22:12:27 +00:00
|
|
|
.\" .Ar console
|
|
|
|
.\" as the name of the device that local X sessions (ut_host of ":0.0")
|
|
|
|
.\" originate from. If any login has been recorded on
|
|
|
|
.\" .Ar console
|
|
|
|
.\" then these X sessions are ignored unless COMPAT_SUNOS was defined at
|
|
|
|
.\" compile time.
|
1994-05-26 05:23:31 +00:00
|
|
|
.It Fl p
|
1994-09-26 22:12:27 +00:00
|
|
|
Print individual users' totals.
|
|
|
|
.It Fl t Ar tty
|
2004-07-02 23:13:00 +00:00
|
|
|
Only do accounting logins on certain ttys.
|
|
|
|
The
|
1994-09-26 22:12:27 +00:00
|
|
|
.Ar tty
|
|
|
|
specification can start with '!' to indicate not this
|
|
|
|
.Ar tty
|
|
|
|
and end with '*' to indicate all similarly named ttys.
|
|
|
|
Multiple
|
|
|
|
.Fl t
|
|
|
|
flags may be specified.
|
|
|
|
.It Fl w Ar wtmp
|
|
|
|
Read connect time data from
|
|
|
|
.Ar wtmp
|
|
|
|
instead of the default file,
|
2010-01-21 17:25:12 +00:00
|
|
|
.Pa /var/log/utx.log .
|
1994-05-26 05:23:31 +00:00
|
|
|
.It Ar users ...
|
1994-09-26 22:12:27 +00:00
|
|
|
Display totals for the given individuals only.
|
1994-05-26 05:23:31 +00:00
|
|
|
.El
|
|
|
|
.Pp
|
|
|
|
If no arguments are given,
|
1997-09-01 06:11:40 +00:00
|
|
|
.Nm
|
1994-09-26 22:12:27 +00:00
|
|
|
displays the total connect time for all
|
|
|
|
accounts with login sessions recorded in
|
2010-01-21 17:25:12 +00:00
|
|
|
.Pa utx.log .
|
1994-05-26 05:23:31 +00:00
|
|
|
.Pp
|
|
|
|
The default
|
2010-01-21 17:25:12 +00:00
|
|
|
.Pa utx.log
|
1994-09-26 22:12:27 +00:00
|
|
|
file will increase without bound unless it is truncated.
|
|
|
|
It is normally truncated by the daily scripts run
|
|
|
|
by
|
|
|
|
.Xr cron 8 ,
|
1994-05-26 05:23:31 +00:00
|
|
|
which rename and rotate the
|
2010-01-21 17:25:12 +00:00
|
|
|
.Pa utx.log
|
1994-09-26 22:12:27 +00:00
|
|
|
files, keeping a week's worth of data on
|
2004-07-02 23:13:00 +00:00
|
|
|
hand.
|
|
|
|
No login or connect time accounting is performed if
|
2010-01-21 17:25:12 +00:00
|
|
|
.Pa /var/log/utx.log
|
1994-09-26 22:12:27 +00:00
|
|
|
does not exist.
|
1994-05-26 05:23:31 +00:00
|
|
|
.Sh FILES
|
2010-01-21 17:25:12 +00:00
|
|
|
.Bl -tag -width /var/log/utx.log -compact
|
|
|
|
.It Pa /var/log/utx.log
|
1994-09-26 22:12:27 +00:00
|
|
|
connect time accounting file
|
1994-05-26 05:23:31 +00:00
|
|
|
.El
|
2005-01-18 20:02:45 +00:00
|
|
|
.Sh EXIT STATUS
|
|
|
|
.Ex -std
|
2013-03-17 06:54:04 +00:00
|
|
|
.Sh EXAMPLES
|
|
|
|
Allow times recorded in
|
|
|
|
.Pa modems
|
|
|
|
to be charged out at a different rate than
|
|
|
|
.Pa other :
|
|
|
|
.Bd -literal -offset indent
|
|
|
|
ac -p -t "ttyd*" > modems
|
|
|
|
ac -p -t "!ttyd*" > other
|
|
|
|
.Ed
|
1994-05-26 05:23:31 +00:00
|
|
|
.Sh SEE ALSO
|
|
|
|
.Xr login 1 ,
|
2010-01-21 17:25:12 +00:00
|
|
|
.Xr getutxent 3 ,
|
1997-01-20 00:03:00 +00:00
|
|
|
.Xr init 8 ,
|
|
|
|
.Xr sa 8
|
2020-02-19 12:49:49 +00:00
|
|
|
.Sh HISTORY
|
|
|
|
An
|
|
|
|
.Nm
|
|
|
|
command appeared in
|
|
|
|
.At v5 .
|
|
|
|
This version of
|
|
|
|
.Nm
|
|
|
|
was written for
|
|
|
|
.Nx 0.9a
|
|
|
|
from the specification provided by various systems' manual pages.
|
1994-09-26 22:12:27 +00:00
|
|
|
.\" .Sh NOTES
|
|
|
|
.\" If COMPAT_SUNOS is defined
|
|
|
|
.\" .Nm ac
|
|
|
|
.\" ignores the fact that entries with ut_host of ":0.0" are not real
|
|
|
|
.\" login sessions. Normally such entries are ignored except in the case
|
2001-07-15 08:06:20 +00:00
|
|
|
.\" of a user being logged in when the
|
1994-09-26 22:12:27 +00:00
|
|
|
.\" .Pa wtmp
|
|
|
|
.\" file was rotated, in which case a login with ut_host of ":0.0" may
|
2001-07-15 08:06:20 +00:00
|
|
|
.\" appear without any preceding console logins.
|
1994-09-26 22:12:27 +00:00
|
|
|
.\" If no one is logged in on the console, the user is deemed to have
|
|
|
|
.\" logged in on at the earliest time stamp found in
|
|
|
|
.\" .Pa wtmp .
|
|
|
|
.\" Use of
|
|
|
|
.\" .Pa console
|
|
|
|
.\" allows
|
|
|
|
.\" .Nm ac
|
1996-01-30 13:52:50 +00:00
|
|
|
.\" to identify and correctly process a logout for the user. The default
|
1994-09-26 22:12:27 +00:00
|
|
|
.\" value for
|
|
|
|
.\" .Pa console
|
|
|
|
.\" is usually correct at compile time.
|