1.\" $NetBSD: ac.8,v 1.13 2002/02/08 01:38:46 ross 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. The 76.Ar tty 77specification can start with 78.Ql ! 79to indicate not this 80.Ar tty 81and end with 82.Ql * 83to indicate all similarly named ttys. 84Multiple 85.Fl t 86flags may be specified. 87.It Fl w Ar file 88Read raw connect time data from 89.Ar file 90instead of the default file 91.Pa /var/log/wtmp . 92.It Ar users ... 93Display totals for the given individuals 94only. 95.El 96.Pp 97If no arguments are given, 98.Nm 99displays the total amount of login time for all active accounts on the 100system. 101.Pp 102The default 103.Pa wtmp 104file is an infinitely increasing file 105unless frequently truncated. This is normally 106done by the daily daemon scripts scheduled by 107.Xr cron 8 , 108which rename and rotate the 109.Pa wtmp 110files before truncating them (and keep about a week's worth on hand). 111No login times are collected, however, if the file does not exist. 112.Pp 113For example, 114.Bd -literal -offset 115ac -p -t "ttyd*" \*[Gt] modems 116ac -p -t "!ttyd*" \*[Gt] other 117.Ed 118.Pp 119allows times recorded in 120.Pa modems 121to be charged out at a different rate than 122.Pa other . 123.Pp 124The 125.Nm 126utility exits 0 on success, and \*[Gt]0 if a fatal error occurs. 127.Sh FILES 128.Bl -tag -width /var/log/wtmp.[0-7] -compact 129.It Pa /var/log/wtmp 130connect time accounting file 131.It Pa /var/log/wtmp.[0-7] 132rotated files 133.El 134.Sh SEE ALSO 135.Xr login 1 , 136.Xr utmp 5 , 137.Xr init 8 , 138.Xr sa 8 139.Sh HISTORY 140An 141.Nm 142command appeard in 143.At v6 . 144This version of 145.Nm 146was written for 147.Nx 1.0 148from the specification provided by various systems' manual pages. 149