Results 1 to 8 of 8

Thread: Tracking total time a user has been logged in (over a period of months)?

  1. #1
    Join Date
    Feb 2008
    Beans
    189

    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:
    Code:
    total   0.00
    Looking for a Terminal Emulator that's fun to use? Try out this program I wrote!

  2. #2
    Join Date
    Nov 2008
    Location
    Maine
    Beans
    1,125
    Distro
    Ubuntu 10.04 Lucid Lynx

    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?
    ~Conradin~

  3. #3
    Join Date
    Nov 2008
    Location
    Maine
    Beans
    1,125
    Distro
    Ubuntu 10.04 Lucid Lynx

    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
    ~Conradin~

  4. #4
    Join Date
    Feb 2008
    Beans
    189

    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.
    Looking for a Terminal Emulator that's fun to use? Try out this program I wrote!

  5. #5
    Join Date
    Feb 2008
    Beans
    189

    Re: Tracking total time a user has been logged in (over a period of months)?

    .......buuuuuuuuuump.
    Looking for a Terminal Emulator that's fun to use? Try out this program I wrote!

  6. #6
    Join Date
    Nov 2010
    Location
    India
    Beans
    4,828
    Distro
    Ubuntu Development Release

    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 .

    Code:
    uptime
    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 .
    Raja

    రాజ శేఖర్ రెడ్డి

  7. #7
    Join Date
    Feb 2008
    Beans
    189

    Re: Tracking total time a user has been logged in (over a period of months)?

    Quote Originally Posted by raja.genupula View Post
    what i am thinking that , the past information you can't retrieve but you can make it available for future .

    Code:
    uptime
    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.
    Looking for a Terminal Emulator that's fun to use? Try out this program I wrote!

  8. #8
    Join Date
    Nov 2010
    Location
    India
    Beans
    4,828
    Distro
    Ubuntu Development Release

    Re: Tracking total time a user has been logged in (over a period of months)?

    Quote Originally Posted by yanom View Post
    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
    Raja

    రాజ శేఖర్ రెడ్డి

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •