[NTLUG:Discuss] Can Linux help me limit my kids' time on the computer?
Wayne Walker
wwalker at bybent.com
Tue Dec 26 20:02:03 CST 2006
last and a little shell magic shows how much time was spent in 1 short
line....
[ (0) wwalker at behemoth:~ ]$ last
wwalker tty1 Tue Dec 26 13:18 still logged
in
reboot system boot 2.6.18-1.2868.fc Tue Dec 26 12:36 (07:14)
wwalker tty3 Tue Dec 26 09:01 - down (02:05)
wwalker tty3 Tue Dec 26 08:46 - 09:01 (00:15)
wwalker tty3 Tue Dec 26 08:42 - 08:45 (00:02)
wwalker tty3 Tue Dec 26 08:20 - 08:22 (00:01)
root tty3 Mon Dec 25 21:36 - 08:20 (10:44)
root tty2 Mon Dec 25 21:34 - 09:01 (11:27)
root tty2 Mon Dec 25 18:06 - 18:07 (00:00)
root tty1 Mon Dec 25 17:45 - 08:49 (15:04)
root tty1 Mon Dec 25 17:42 - 17:45 (00:02)
reboot system boot 2.6.18-1.2798.fc Mon Dec 25 17:40 (17:26)
wtmp begins Mon Dec 25 17:40:47 2006
[ (0) wwalker at behemoth:~ ]$ last | grep 'wwalker.*)' | sed -e 's/^.*(//' -e 's/)//'
02:05
00:15
00:02
00:01
2 hours and 23 minutes.
[ (0) wwalker at behemoth:~ ]$ last | grep wwalker.*\) | sed -e 's/^.*(//' -e 's/)//' | perl -e 'while(<>) { ($h,$m) = split /:/; $H += $h; $M += $m }; $minutes = $M%60; $hours = $H + ($M - $minutes)/60; print "$H:$M\n";'
2:23
[ (0) wwalker at behemoth:~ ]$
Admittedly that's a bit much for the average perl one liner, but you
could put that in a script and you are set.
Wayne
On Tue, Dec 26, 2006 at 05:34:02PM -0600, Lance Simmons wrote:
> On 12/26/06, steve <sjbaker1 at airmail.net> wrote:
>
> > But if you REALLY must do this (sending the message "I don't
> > trust you" to your child).
>
> It's not a trust issue. It's that neither of us is really sure how
> much time he's spending on the computer, and we need a way to find
> out. We've settled on an amount of time per week we agree he can
> spend on the computer, but so far there's no easy way of monitoring
> it. I want an easy way to check how much time he's spent in the past
> 7 days.
>
> The "last" command is promising (and I can't believe I didn't know
> about it), but what a pain sorting through the output, and what about
> all the login shells that are run during one session? Isn't there a
> program that can analyze the logs and give an accurate number of hours
> he has used the computer each day? It needs to be something he can
> easily use to tell how much time he's on the computer.
>
> _______________________________________________
> http://www.ntlug.org/mailman/listinfo/discuss
--
Wayne Walker
www.unwiredbuyer.com - when you just can't be by the computer
wwalker at bybent.com Do you use Linux?!
http://www.bybent.com Get Counted! http://counter.li.org/
Perl - http://www.perl.org/ Perl User Groups - http://www.pm.org/
Jabber: wwalker at jabber.gnumber.com AIM: lwwalkerbybent
IRC: wwalker on freenode.net
More information about the Discuss
mailing list