shell script to calculate the time a user is logged in
i am trying to write a shellscript which will provide the name ,logged in time , logout time and total time for all the users accessing a particular machine..how do i do this...with the last command i got many details..can i extract te needed values from the output of this command..please help..
thanks in advancehttp://www.linuxquestions.org/questions/newthread.php?s=&action=newthread&forumid=8#
'who' will tell you who is logged in and what time they logged in. Not sure about logout time though. You could use last and pipe the output through awk which will let you extract the fields using $1 $2 $3 etc for each field.
Have a look at the output of
Depending on how (whether) you shut down the
box it will provide reasonably accurate time info
for users ...
|All times are GMT -5. The time now is 08:47 AM.|