[plug] login stats

Bret Busby bret at clearsol.iinet.net.au
Thu Oct 5 13:51:14 WST 2000


Denis Brown wrote:
> 
> Bret,
> 
> This may differ between distributions but my man page for "last" shows a
> pseudo user called "reboot" which apparently defines the time of reboot.  I
> can't tell whether that will do what you want, though, because my wtmp file
> does not go back (the 390-odd days) to my last reboot.
> 
> My guess though is that a bit of sniffing around with the "last reboot" and
> "last" commands could yield the information you're after with a bit of
> scripting to glue it together.
> 
> Hope this helps,
> Denis

It is the scripting that is the problem.

Processing the wtmp file, to process all records, for a specified user,
back from the last entry, to the most recent occurrence of reboot (from
the top of the file; the most recent entry, going down the file, toward
the earliest entry), is notsomuch the problem, as trying to do "time
arithmetic" on the time entries. That is where the problem lies.

Extracting the fields for the times (where a user is still logged in;
the time logged in, and, for a previous login session; the time elapsed
of the login session - the last column), returns caharacter strings.

What I am seeking, is advice as to how to perform the "time arithmetic",
on the fields (finding the time elapsed from the start time of a current
login session, and, adding times, such as the times displayed in the
last column of the report that is displayed, when last is run).

That is the problem.

-- 

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