1*dd2e81b7Sjsg.\" $OpenBSD: ac.8,v 1.23 2020/02/08 01:43:22 jsg Exp $ 28eb2d359Sjmc.\" 3df930be7Sderaadt.\" Copyright (c) 1994 Simon J. Gerraty 4df930be7Sderaadt.\" Copyright (c) 1994 Christopher G. Demetriou 5df930be7Sderaadt.\" All rights reserved. 6df930be7Sderaadt.\" 7df930be7Sderaadt.\" Redistribution and use in source and binary forms, with or without 8df930be7Sderaadt.\" modification, are permitted provided that the following conditions 9df930be7Sderaadt.\" are met: 10df930be7Sderaadt.\" 1. Redistributions of source code must retain the above copyright 11df930be7Sderaadt.\" notice, this list of conditions and the following disclaimer. 12df930be7Sderaadt.\" 2. Redistributions in binary form must reproduce the above copyright 13df930be7Sderaadt.\" notice, this list of conditions and the following disclaimer in the 14df930be7Sderaadt.\" documentation and/or other materials provided with the distribution. 15df930be7Sderaadt.\" 3. All advertising materials mentioning features or use of this software 16df930be7Sderaadt.\" must display the following acknowledgement: 17df930be7Sderaadt.\" This product includes software developed by Christopher G. Demetriou. 18df930be7Sderaadt.\" 3. The name of the author may not be used to endorse or promote products 19df930be7Sderaadt.\" derived from this software without specific prior written permission 20df930be7Sderaadt.\" 21df930be7Sderaadt.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 22df930be7Sderaadt.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 23df930be7Sderaadt.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 24df930be7Sderaadt.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 25df930be7Sderaadt.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 26df930be7Sderaadt.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27df930be7Sderaadt.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28df930be7Sderaadt.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29df930be7Sderaadt.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 30df930be7Sderaadt.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31df930be7Sderaadt.\" 32*dd2e81b7Sjsg.Dd $Mdocdate: February 8 2020 $ 33df930be7Sderaadt.Dt AC 8 3419244f19Smichaels.Os 35df930be7Sderaadt.Sh NAME 36df930be7Sderaadt.Nm ac 37df930be7Sderaadt.Nd connect time accounting 38df930be7Sderaadt.Sh SYNOPSIS 395c3dced3Saaron.Nm ac 40df930be7Sderaadt.Op Fl dp 41df930be7Sderaadt.Op Fl t Ar tty 42df930be7Sderaadt.Op Fl w Ar wtmp 430d5c87f9Ssobrado.Op Ar user ... 44df930be7Sderaadt.Sh DESCRIPTION 45df930be7SderaadtIf the file 46df930be7Sderaadt.Pa /var/log/wtmp 47df930be7Sderaadtexists, a record of individual login and logout 48df930be7Sderaadttimes are written to it by 49046e7ae9Smarc.Xr login 1 50df930be7Sderaadtand 51df930be7Sderaadt.Xr init 8 , 52df930be7Sderaadtrespectively. 536931a8aaSaaron.Nm 54df930be7Sderaadtexamines these records and writes the accumulated connect time 55df930be7Sderaadtfor all logins to the standard output. 56df930be7Sderaadt.Pp 57df930be7SderaadtThe options are as follows: 58f1ba3473Saaron.Bl -tag -width Ds 59df930be7Sderaadt.It Fl d 60df930be7SderaadtDisplay the connect times in 24 hour chunks. 61df930be7Sderaadt.It Fl p 62df930be7SderaadtPrint individual users' totals. 63df930be7Sderaadt.It Fl t Ar tty 64cdbdb68aSaaronOnly do accounting logins on certain ttys. 65cdbdb68aSaaronThe 66df930be7Sderaadt.Ar tty 676931a8aaSaaronspecification can start with 686931a8aaSaaron.Ql \&! 696931a8aaSaaronto indicate not this 70df930be7Sderaadt.Ar tty 716931a8aaSaaronand end with 726931a8aaSaaron.Ql * 736931a8aaSaaronto indicate all similarly named ttys. 74df930be7SderaadtMultiple 75df930be7Sderaadt.Fl t 76df930be7Sderaadtflags may be specified. 77df930be7Sderaadt.It Fl w Ar wtmp 78df930be7SderaadtRead connect time data from 79df930be7Sderaadt.Ar wtmp 80df930be7Sderaadtinstead of the default file, 81df930be7Sderaadt.Pa /var/log/wtmp . 820d5c87f9Ssobrado.It Ar user ... 83df930be7SderaadtDisplay totals for the given individuals only. 84df930be7Sderaadt.El 85df930be7Sderaadt.Pp 86df930be7SderaadtIf no arguments are given, 876931a8aaSaaron.Nm 88df930be7Sderaadtdisplays the total connect time for all 89df930be7Sderaadtaccounts with login sessions recorded in 905f8a5558Sjmc.Xr wtmp 5 . 91df930be7Sderaadt.Pp 92df930be7SderaadtThe default 93df930be7Sderaadt.Pa wtmp 94df930be7Sderaadtfile will increase without bound unless it is truncated. 958eb2d359SjmcIt is normally truncated by 968eb2d359Sjmc.Xr newsyslog 8 , 978eb2d359Sjmcwhich renames and rotates the 98df930be7Sderaadt.Pa wtmp 998e9b2a2fSajacoutotfiles every week. 1005f8a5558SjmcIn order for 1015f8a5558Sjmc.Nm 1025f8a5558Sjmcto run in sync with the rotation of 1035f8a5558Sjmc.Pa wtmp , 1045f8a5558Sjmc.Xr newsyslog 8 1058e9b2a2fSajacoutotis configured to run 1065f8a5558Sjmcjust after 107fdd89a80Sjmc.Nm 1085f8a5558Sjmccompletes. 1095f8a5558Sjmc.Pp 110533e1995SjmcUser accounting information can be mailed weekly 111533e1995Sjmcto the system administrator: 112533e1995Sjmcsee 113533e1995Sjmc.Xr weekly 8 114533e1995Sjmcfor more information. 115cdbdb68aSaaronNo login or connect time accounting is performed if 116df930be7Sderaadt.Pa /var/log/wtmp 117df930be7Sderaadtdoes not exist. 118df930be7Sderaadt.Sh FILES 1195f8a5558Sjmc.Bl -tag -width "/var/log/wtmp.[0-7]XX" -compact 120df930be7Sderaadt.It Pa /var/log/wtmp 121df930be7Sderaadtconnect time accounting file 122df930be7Sderaadt.It Pa /var/log/wtmp.[0-7] 123df930be7Sderaadtrotated files 124df930be7Sderaadt.El 125741b6f30Sjmc.Sh EXIT STATUS 126741b6f30Sjmc.Ex -std ac 1275f8a5558Sjmc.Sh EXAMPLES 1285f8a5558SjmcAllow times recorded in 1295f8a5558Sjmc.Pa modems 1305f8a5558Sjmcto be charged out at a different rate than 1315f8a5558Sjmc.Pa other : 1325f8a5558Sjmc.Bd -literal -offset indent 1335f8a5558Sjmc$ ac -p -t "ttyd*" \*(Gt modems 1345f8a5558Sjmc$ ac -p -t "!ttyd*" \*(Gt other 1355f8a5558Sjmc.Ed 136df930be7Sderaadt.Sh SEE ALSO 137df930be7Sderaadt.Xr login 1 , 1385f8a5558Sjmc.Xr wtmp 5 , 1398eb2d359Sjmc.Xr cron 8 , 1406f10db5aSaaron.Xr init 8 , 1418eb2d359Sjmc.Xr newsyslog 8 , 1426f10db5aSaaron.Xr sa 8 143df930be7Sderaadt.Sh HISTORY 144df930be7SderaadtAn 1456931a8aaSaaron.Nm 146f7de5c7bSalexcommand appeared in 147*dd2e81b7Sjsg.At v5 . 148df930be7SderaadtThis version of 1496931a8aaSaaron.Nm 150df930be7Sderaadtwas written for 151df930be7Sderaadt.Nx 0.9a 152df930be7Sderaadtfrom the specification provided by various systems' manual pages. 153