On Thu, Jan 30, 2014 at 7:40 PM, Dallin Jones <[email protected]> wrote: > Does last not provide the information you are looking for? What about the ac > command?
last provides the raw information, but there are some gotchas. Handling crashes a little more cleanly, as far as reporting to people fighting over times is concerned. Last shows every terminal connection; whether pts or tty. ac appears to go off of that. So, anytime a person opens a terminal window of any kind that time is included. For example, the output of my howlong program--which has been loosely verified as being accurate enough--dumps the following for last Sunday: deedee Sun Jan 26 15:19 - 16:05 (00:45) james Sun Jan 26 12:52 - 15:19 (02:27) deedee Sun Jan 26 10:46 - 12:51 (02:04) patrick Sun Jan 26 07:48 - 10:46 (02:57) patrick Sun Jan 26 07:39 - crash (00:07) But ac reports: $ for c in deedee james patrick ; do ac -d $c ; done | grep 'Jan 26' Jan 26 total 5.64 Jan 26 total 4.36 Jan 26 total 2.97 Both DeeDee and James play minecraft, which they start by running konsole or xterm and running a simple shell script. When they are done they rarely close the terminal window and just move on to the next application they want to use. So, as long as that second terminal window is open their time being reported by existing tools is doubled. If they open a new terminal window to go back into minecraft that time is now being tripled. You can see this in the output of ac. Patrick does not play minecraft, so his numbers match up. I can use the output I get from my howlong program--actually, I'd massage the data a little differently--but I wanted to make sure I wasn't reinventing the wheel. What I need, whether it exists somewhere or I need to write it, is a report of how long people have been on the computer today (along with times), by week and by month. I know about wtmp and utmp, I'd either have to parse the output of last, which might be simpler; or access those files and handle all the various issues with that. -- Alan Young /* PLUG: http://plug.org, #utah on irc.freenode.net Unsubscribe: http://plug.org/mailman/options/plug Don't fear the penguin. */
