1.\" $NetBSD: ac.8,v 1.19 2017/07/03 21:35:29 wiz Exp $ 2.\" 3.\" Copyright (c) 1980, 1991, 1993 4.\" The Regents of the University of California. All rights reserved. 5.\" Copyright (c) 1994 Simon J. Gerraty 6.\" Copyright (c) 1994 Christopher G. Demetriou 7.\" All rights reserved. 8.\" 9.\" Redistribution and use in source and binary forms, with or without 10.\" modification, are permitted provided that the following conditions 11.\" are met: 12.\" 1. Redistributions of source code must retain the above copyright 13.\" notice, this list of conditions and the following disclaimer. 14.\" 2. Redistributions in binary form must reproduce the above copyright 15.\" notice, this list of conditions and the following disclaimer in the 16.\" documentation and/or other materials provided with the distribution. 17.\" 3. All advertising materials mentioning features or use of this software 18.\" must display the following acknowledgements: 19.\" This product includes software developed by the University of 20.\" California, Berkeley and its contributors. 21.\" This product includes software developed by Christopher G. Demetriou. 22.\" 4. Neither the name of the University nor the names of its contributors 23.\" may be used to endorse or promote products derived from this software 24.\" without specific prior written permission. 25.\" 26.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 27.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 28.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 29.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 30.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 31.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 32.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 33.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 34.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 35.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 36.\" SUCH DAMAGE. 37.\" 38.\" @(#)ac.8 8.2 (Berkeley) 4/19/94 39.\" 40.Dd April 19, 1994 41.Dt AC 8 42.Os 43.Sh NAME 44.Nm ac 45.Nd display connect time accounting 46.Sh SYNOPSIS 47.Nm 48.Op Fl d | p 49.Op Fl t Ar tty 50.Op Fl w Ar file 51.Op Ar users ... 52.Sh DESCRIPTION 53If the file 54.Pa /var/log/wtmp 55exists, 56a record of individual 57login and logout times are written to it by 58.Xr login 1 59and 60.Xr init 8 , 61respectively. 62The program 63.Nm 64examines these 65records and writes the accumulated connect time for all logins to the 66standard output. 67.Pp 68Options available: 69.Bl -tag -width indentXXX 70.It Fl d 71Display the connect times in 24 hour chunks. 72.It Fl p 73Display individual user totals. 74.It Fl t Ar tty 75Only do accounting logins on certain ttys. 76The 77.Ar tty 78specification can start with 79.Ql \&! 80to indicate not this 81.Ar tty 82and end with 83.Ql * 84to indicate all similarly named ttys. 85Multiple 86.Fl t 87flags may be specified. 88.It Fl w Ar file 89Read raw connect time data from 90.Ar file 91instead of the default file 92.Pa /var/log/wtmp . 93.It Ar users ... 94Display totals for the given individuals 95only. 96.El 97.Pp 98If no arguments are given, 99.Nm 100displays the total amount of login time for all active accounts on the 101system. 102.Pp 103The default 104.Pa wtmp 105file is an infinitely increasing file 106unless frequently truncated. 107This is normally done by the daily daemon scripts scheduled by 108.Xr cron 8 , 109which rename and rotate the 110.Pa wtmp 111files before truncating them (and keep about a week's worth on hand). 112No login times are collected, however, if the file does not exist. 113.Pp 114For example, 115.Bd -literal -offset indent 116ac -p -t "ttyd*" > modems 117ac -p -t "!ttyd*" > other 118.Ed 119.Pp 120allows times recorded in 121.Pa modems 122to be charged out at a different rate than 123.Pa other . 124.Sh FILES 125.Bl -tag -width /var/log/wtmp.[0-7] -compact 126.It Pa /var/log/wtmp 127connect time accounting file 128.It Pa /var/log/wtmp.[0-7] 129rotated files 130.El 131.Sh EXIT STATUS 132.Ex -std ac 133.Sh SEE ALSO 134.Xr login 1 , 135.Xr utmp 5 , 136.Xr init 8 , 137.Xr sa 8 138.Sh HISTORY 139An 140.Nm 141command appeared in 142.At v6 . 143This version of 144.Nm 145was written for 146.Nx 1.0 147from the specification provided by various systems' manual pages. 148