Tracking total time a user has been logged in (over a period of months)?
I need a way to track and display the amount of time a user has spent logged in to the system over the past day,week,month,year etc? I tried the acct package, but the AC command always just shows:
Re: Tracking total time a user has been logged in (over a period of months)?
should we assume any given user is logging in, or out?
I think you can use the last command to see who was logged in when.
is this users on 1 computer or users on multiple computers like with LDAP?
Re: Tracking total time a user has been logged in (over a period of months)?
I think you can use the last command to see who was logged in when.
Im not sure where a con fig file is for last, but /var/log/wtmp is the file of logins.
the output of last on my system seems to be about 1 week
Re: Tracking total time a user has been logged in (over a period of months)?
I want to track the total time a given user had been using the computer this month (day/week/year etc). It's only one machine, not a network.
Re: Tracking total time a user has been logged in (over a period of months)?
Re: Tracking total time a user has been logged in (over a period of months)?
what i am thinking that , the past information you can't retrieve but you can make it available for future .
is BASH command while gives the
Code:
19:56:23 up 32 min, 0 users, load average: 0.53, 0.61, 0.66
there up will indicates the uptime . so what i suggest that , you can have script like this and add to before shutdown .
http://en.kioskea.net/faq/3348-ubunt...pt-at-shutdown
Code:
raja@badfox:~$ cat try.sh
#!/bin/bash
uptime > uptime.txt
date
awk '{print $3 $4}' uptime.txt
Code:
raja@badfox:~$ ./try.sh
Thu Oct 11 20:06:57 IST 2012
43 min
Code:
raja@badfox:~$ ./try.sh >> time.txt
so add this script to before shutdown so every time it will run automatically and stores the information everytime with date also . so you can easily track his time history .
Thanks man , nice Question .
PS : any improvements are welcome here .
Re: Tracking total time a user has been logged in (over a period of months)?
Quote:
Originally Posted by
raja.genupula
what i am thinking that , the past information you can't retrieve but you can make it available for future .
is BASH command while gives the
Code:
19:56:23 up 32 min, 0 users, load average: 0.53, 0.61, 0.66
there up will indicates the uptime . so what i suggest that , you can have script like this and add to before shutdown .
http://en.kioskea.net/faq/3348-ubunt...pt-at-shutdown
Code:
raja@badfox:~$ cat try.sh
#!/bin/bash
uptime > uptime.txt
date
awk '{print $3 $4}' uptime.txt
Code:
raja@badfox:~$ ./try.sh
Thu Oct 11 20:06:57 IST 2012
43 min
Code:
raja@badfox:~$ ./try.sh >> time.txt
so add this script to before shutdown so every time it will run automatically and stores the information everytime with date also . so you can easily track his time history .
Thanks man , nice Question .
PS : any improvements are welcome here .
mmm, thanks for the reply. However, there are multiple accounts on this machine, and I need to see how long each account has used the machine for. Also, these sit in the community library, so much of the uptime will be spent at the login screen with nobody using it, but still accruing uptime.
Re: Tracking total time a user has been logged in (over a period of months)?
Quote:
Originally Posted by
yanom
mmm, thanks for the reply. However, there are multiple accounts on this machine, and I need to see how long each account has used the machine for. Also, these sit in the community library, so much of the uptime will be spent at the login screen with nobody using it, but still accruing uptime.
ok check here . you can have the script running for logout
http://superuser.com/questions/12745...hutdown-ubuntu