xref: /freebsd/usr.sbin/ac/ac.8 (revision fa9896e082a1046ff4fbc75fcba4d18d1f2efc19)
1ff9c3a32SDavid Greenman.\"
2ff9c3a32SDavid Greenman.\" Copyright (c) 1994 Simon J. Gerraty
3ff9c3a32SDavid Greenman.\" Copyright (c) 1994 Christopher G. Demetriou
4ff9c3a32SDavid Greenman.\" All rights reserved.
5dea673e9SRodney W. Grimes.\"
6dea673e9SRodney W. Grimes.\" Redistribution and use in source and binary forms, with or without
7dea673e9SRodney W. Grimes.\" modification, are permitted provided that the following conditions
8dea673e9SRodney W. Grimes.\" are met:
9dea673e9SRodney W. Grimes.\" 1. Redistributions of source code must retain the above copyright
10dea673e9SRodney W. Grimes.\"    notice, this list of conditions and the following disclaimer.
11dea673e9SRodney W. Grimes.\" 2. Redistributions in binary form must reproduce the above copyright
12dea673e9SRodney W. Grimes.\"    notice, this list of conditions and the following disclaimer in the
13dea673e9SRodney W. Grimes.\"    documentation and/or other materials provided with the distribution.
14dea673e9SRodney W. Grimes.\"
15ff9c3a32SDavid Greenman.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16ff9c3a32SDavid Greenman.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17ff9c3a32SDavid Greenman.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18ff9c3a32SDavid Greenman.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19ff9c3a32SDavid Greenman.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20ff9c3a32SDavid Greenman.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21ff9c3a32SDavid Greenman.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22ff9c3a32SDavid Greenman.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23ff9c3a32SDavid Greenman.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24ff9c3a32SDavid Greenman.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25dea673e9SRodney W. Grimes.\"
26*8209febbSSergio Carlavilla Delgado.Dd February 14, 2020
27dea673e9SRodney W. Grimes.Dt AC 8
28ff9c3a32SDavid Greenman.Os
29dea673e9SRodney W. Grimes.Sh NAME
30dea673e9SRodney W. Grimes.Nm ac
31ff9c3a32SDavid Greenman.Nd connect time accounting
32dea673e9SRodney W. Grimes.Sh SYNOPSIS
33e97407b4SRuslan Ermilov.Nm
34ff9c3a32SDavid Greenman.Op Fl dp
35ff9c3a32SDavid Greenman.\".Op Fl c Ar console
36ff9c3a32SDavid Greenman.Op Fl t Ar tty
37ff9c3a32SDavid Greenman.Op Fl w Ar wtmp
38dea673e9SRodney W. Grimes.Op Ar users ...
39dea673e9SRodney W. Grimes.Sh DESCRIPTION
40dea673e9SRodney W. GrimesIf the file
410806dd92SEd Schouten.Pa /var/log/utx.log
42ff9c3a32SDavid Greenmanexists, a record of individual login and logout
43ff9c3a32SDavid Greenmantimes are written to it by
44906c1e27SMike Pritchard.Xr login 1
45ff9c3a32SDavid Greenmanand
46ff9c3a32SDavid Greenman.Xr init 8 ,
47dea673e9SRodney W. Grimesrespectively.
48490d5836SPhilippe CharnierThe
49490d5836SPhilippe Charnier.Nm
50490d5836SPhilippe Charnierutility
512362d22eSJoerg Wunschexamines these records and writes the accumulated connect time (in hours)
52ff9c3a32SDavid Greenmanfor all logins to the standard output.
53dea673e9SRodney W. Grimes.Pp
54ff9c3a32SDavid GreenmanThe options are as follows:
55ff9c3a32SDavid Greenman.Bl -tag -width indentXXX
56dea673e9SRodney W. Grimes.It Fl d
57dea673e9SRodney W. GrimesDisplay the connect times in 24 hour chunks.
58ff9c3a32SDavid Greenman.\" .It Fl c Ar console
59ff9c3a32SDavid Greenman.\" Use
60ff9c3a32SDavid Greenman.\" .Ar console
61ff9c3a32SDavid Greenman.\" as the name of the device that local X sessions (ut_host of ":0.0")
62ff9c3a32SDavid Greenman.\" originate from.  If any login has been recorded on
63ff9c3a32SDavid Greenman.\" .Ar console
64ff9c3a32SDavid Greenman.\" then these X sessions are ignored unless COMPAT_SUNOS was defined at
65ff9c3a32SDavid Greenman.\" compile time.
66dea673e9SRodney W. Grimes.It Fl p
67ff9c3a32SDavid GreenmanPrint individual users' totals.
68ff9c3a32SDavid Greenman.It Fl t Ar tty
6907bfccd7SRuslan ErmilovOnly do accounting logins on certain ttys.
7007bfccd7SRuslan ErmilovThe
71ff9c3a32SDavid Greenman.Ar tty
72ff9c3a32SDavid Greenmanspecification can start with '!' to indicate not this
73ff9c3a32SDavid Greenman.Ar tty
74ff9c3a32SDavid Greenmanand end with '*' to indicate all similarly named ttys.
75ff9c3a32SDavid GreenmanMultiple
76ff9c3a32SDavid Greenman.Fl t
77ff9c3a32SDavid Greenmanflags may be specified.
78ff9c3a32SDavid Greenman.It Fl w Ar wtmp
79ff9c3a32SDavid GreenmanRead connect time data from
80ff9c3a32SDavid Greenman.Ar wtmp
81ff9c3a32SDavid Greenmaninstead of the default file,
820806dd92SEd Schouten.Pa /var/log/utx.log .
83dea673e9SRodney W. Grimes.It Ar users ...
84ff9c3a32SDavid GreenmanDisplay totals for the given individuals only.
85dea673e9SRodney W. Grimes.El
86dea673e9SRodney W. Grimes.Pp
87dea673e9SRodney W. GrimesIf no arguments are given,
883efa2f58SPhilippe Charnier.Nm
89ff9c3a32SDavid Greenmandisplays the total connect time for all
90ff9c3a32SDavid Greenmanaccounts with login sessions recorded in
910806dd92SEd Schouten.Pa utx.log .
92dea673e9SRodney W. Grimes.Pp
93dea673e9SRodney W. GrimesThe default
940806dd92SEd Schouten.Pa utx.log
95ff9c3a32SDavid Greenmanfile will increase without bound unless it is truncated.
96ff9c3a32SDavid GreenmanIt is normally truncated by the daily scripts run
97ff9c3a32SDavid Greenmanby
98ff9c3a32SDavid Greenman.Xr cron 8 ,
99dea673e9SRodney W. Grimeswhich rename and rotate the
1000806dd92SEd Schouten.Pa utx.log
101ff9c3a32SDavid Greenmanfiles, keeping a week's worth of data on
10207bfccd7SRuslan Ermilovhand.
10307bfccd7SRuslan ErmilovNo login or connect time accounting is performed if
1040806dd92SEd Schouten.Pa /var/log/utx.log
105ff9c3a32SDavid Greenmandoes not exist.
106dea673e9SRodney W. Grimes.Sh FILES
1070806dd92SEd Schouten.Bl -tag -width /var/log/utx.log -compact
1080806dd92SEd Schouten.It Pa /var/log/utx.log
109ff9c3a32SDavid Greenmanconnect time accounting file
110dea673e9SRodney W. Grimes.El
11159a3c79dSRuslan Ermilov.Sh EXIT STATUS
11259a3c79dSRuslan Ermilov.Ex -std
113c65b9b0bSJoel Dahl.Sh EXAMPLES
114c65b9b0bSJoel DahlAllow times recorded in
115c65b9b0bSJoel Dahl.Pa modems
116c65b9b0bSJoel Dahlto be charged out at a different rate than
117c65b9b0bSJoel Dahl.Pa other :
118c65b9b0bSJoel Dahl.Bd -literal -offset indent
119c65b9b0bSJoel Dahlac -p -t "ttyd*" > modems
120c65b9b0bSJoel Dahlac -p -t "!ttyd*" > other
121c65b9b0bSJoel Dahl.Ed
122dea673e9SRodney W. Grimes.Sh SEE ALSO
123dea673e9SRodney W. Grimes.Xr login 1 ,
1240806dd92SEd Schouten.Xr getutxent 3 ,
125bfd34a4aSWolfram Schneider.Xr init 8 ,
126bfd34a4aSWolfram Schneider.Xr sa 8
127*8209febbSSergio Carlavilla Delgado.Sh HISTORY
128*8209febbSSergio Carlavilla DelgadoAn
129*8209febbSSergio Carlavilla Delgado.Nm
130*8209febbSSergio Carlavilla Delgadocommand appeared in
131*8209febbSSergio Carlavilla Delgado.At v5 .
132*8209febbSSergio Carlavilla DelgadoThis version of
133*8209febbSSergio Carlavilla Delgado.Nm
134*8209febbSSergio Carlavilla Delgadowas written for
135*8209febbSSergio Carlavilla Delgado.Nx 0.9a
136*8209febbSSergio Carlavilla Delgadofrom the specification provided by various systems' manual pages.
137ff9c3a32SDavid Greenman.\" .Sh NOTES
138ff9c3a32SDavid Greenman.\" If COMPAT_SUNOS is defined
139ff9c3a32SDavid Greenman.\" .Nm ac
140ff9c3a32SDavid Greenman.\" ignores the fact that entries with ut_host of ":0.0" are not real
141ff9c3a32SDavid Greenman.\" login sessions.  Normally such entries are ignored except in the case
142ff9c3a32SDavid Greenman.\" of a user being logged in when the
143ff9c3a32SDavid Greenman.\" .Pa wtmp
144ff9c3a32SDavid Greenman.\" file was rotated, in which case a login with ut_host of ":0.0" may
1454a8d0283SMike Pritchard.\" appear without any preceding console logins.
146ff9c3a32SDavid Greenman.\" If no one is logged in on the console, the user is deemed to have
147ff9c3a32SDavid Greenman.\" logged in on at the earliest time stamp found in
148ff9c3a32SDavid Greenman.\" .Pa wtmp .
149ff9c3a32SDavid Greenman.\" Use of
150ff9c3a32SDavid Greenman.\" .Pa console
151ff9c3a32SDavid Greenman.\" allows
152ff9c3a32SDavid Greenman.\" .Nm ac
1534a8d0283SMike Pritchard.\" to identify and correctly process a logout for the user.  The default
154ff9c3a32SDavid Greenman.\" value for
155ff9c3a32SDavid Greenman.\" .Pa console
156ff9c3a32SDavid Greenman.\" is usually correct at compile time.
157