I would suggest using the "last" command . . .
e.g. last login USERNAME
Rogan
--
Rogan Dawes rda...@jhbelec.co.za Tel: (011) 490-7379 Fax: (011) 490-7327
"All power corrupts, but we need electricity." - fortune
>How can I get a list of users and the last time/date they logged into the
>system? I don't use accounting. I know it is stored in the lastlog
>file and the lsuser command will list it out, but what format
>is the time_last_login in? BTW, I'm using AIX 3.2.5.
>
>Thanks in advance!
>
>
>dash...@uga.cc.uga.edu
I use "last username | more"
Get a program called date-math
then do this date-math -u <date from time_last_login>
i do it in a user tool script like this
if info=$(lsuser -c -a time_last_login $1) ; then
#checking this one now is useful in case its null (i.e. never
logged i
n)
attributes=$( print $info | cut -d" " -f2- )
if [[ $attributes = $1 ]]; then
lastlogin=""
else
lastlogin=$( print $attributes | cut -d: -f2)
fi
#...print a line about the last login time
if [[ $lastlogin = "" ]]; then
print Never logged in.
else
print Last login was: \
$(/usr/local/bin/date-math -u $lastlogin )
fi
--
__________________________________________________________________
John Andrea St. Francis Xavier Univ.
University Computer Services Antigonish, NS, CANADA B2G 2W5
http://www.stfx.ca/people/jandrea/