[prev in list] [next in list] [prev in thread] [next in thread] 

List:       aix-l
Subject:    Re: lsuser - last login time stamp
From:       "GOODWIN, PATRICK J" <PJGOODWIN () SCANA ! COM>
Date:       1999-05-26 12:30:10
[Download RAW message or body]


Here's a perl program that illustrates converting seconds from the epoch
using the lsuser command:

#!/usr/local/bin/perl
print "Enter the user you want the time_last_login for:\n";
$user=<STDIN>;
$output=`lsuser -a time_last_login time_last_unsuccessful_login $user`;
@numbers=split(" ",$output);
$count=1;
$epoch = scalar(localtime(0));
print time(). " <-- Today's time since the epoch ($epoch) in seconds\n";
# Extract the seconds from the standard output of the lsuser command
while ($count <= 2){
        $position=index($numbers[$count],"=");
        $length=length($numbers[$count]);
        $what=substr($numbers[$count],0,$position);
        $seconds=substr($numbers[$count],$position+1,$length);
        # Print out the critical information in a readable format
        print scalar(localtime($seconds)). " <-- $user's $what time
converted to correct date\n";
        $count++
}

.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
P.J. Goodwin
SCE&G
Unix Systems Administrator
(p) (803) 217-9482
(f) (803) 933-7254

pjgoodwin at scana dot com


-----Original Message-----
From: Barber, Jeffery [mailto:JBarber@AHS.LLUMC.EDU]
Sent: Tuesday, May 25, 1999 7:39 PM
To: Multiple recipients of list AIX-L
Subject: lsuser - last login time stamp


When you do 'lsuser <username>' you are shown a number of attributes. The
attributes that I am interested in is the time_last_login and
time_last_unsuccessful_login. These attribs show some long numeric number.
How can I get this date and time stamp in a format that most humans
understand?

Thanks

Jeffrey 'J' Barber
AIX Consultant
Loma Linda University Medical Center
(909)824-4215 ext. 83513
jbarber@ahs.llumc.edu

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic