Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Keep track of a Mac's usage pattern' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Keep track of a Mac's usage pattern
Authored by: MartySells on Mar 16, '05 11:55:03PM
Wierd - my man page seems to have details. ac gets information from /var/log/wtmp (written to by by init(8) and login(8)) which is the same place that 'last' gets information from. On OSX the wtmp file gets rotated monthly by /etc/periodic/monthly/500.monthly to wtmp.#.gz

The ac man page suggests that the units are hours and testing with ac -p ; sleep 36 ; ac -p seems to confirm this. Realize that ac measures total login time in the Unix sense, not in the OSX sense. If you have multiple shells open (check the output of 'w') then login time will grow faster than 1 hour per real hour of time.

There's also wierd behavior when using ac on rotated wtmp files. When the logs get rotated at end-of-month it's possible for a user to still be logged in. For example a wtmp file for November shows:
$ last -f wtmp.2 jsells | head -1
jsells    console  tinywife.local   Tue Nov 30 21:55   still logged in
This confuses ac into thinking that that session is still logged in as of the date that you run it! So:
$ ac -d -w wtmp.2 jsells | tail -4
Nov 28  total       24.00
Nov 29  total       24.00
Mar 15  total     2543.98
Mar 16  total       23.88
-m

[ Reply to This | # ]