[plug] login stats
Bret Busby
bret at clearsol.iinet.net.au
Thu Oct 5 12:13:57 WST 2000
How can the total login time for a user, since the last reboot, be
found?
last gives a list of the login sessions.
ac gives login time, and can break it down to days.
But, if a system is rebooted in the middle of a day, and the user logged
in before the reboot, and, logged in after the reboot, no method is
apparent, for using ac to go back to a particular time (time of reboot),
or, event (reboot).
last, in giving the login sessions, gives a series of columns as its
output, but, I can't find a function (in bash), which returns the
difference between two times. Eg, the number of hours, or minutes,
passed, from 1100 to the present time (on the basis that the third last
column returns the login session start time, and, if the user is still
logged in, the last field indicates this, with "still logged in").
If I use last, and am able to find the difference between times, I
should be able to extract the login time from last, and, the time field
returned by the date function, and find the difference (date (time) -
last (logon time)).
--
Bret Busby
......................................
"So once you do know what the question actually is, you'll know what the
answer means."
- Deep Thought, Chapter 28 of The Hichhiker's Guide to the Galaxy
- Douglas Adams, 1988
......................................
More information about the plug
mailing list