From: Steve Bagdon (sun@bagdon.com)
Date: Thu Jul 25 2002 - 11:20:28 EDT
And the winner is - Neil Hunt:
"Perhaps you can look at Sys::Lastlog"
Just about everyone says - how hard can it be? Until they try to write it. Last/finger provides some amount of randomness on reporting of date formats, and I wasn't in the mood to write C code to use lastlog.h. So, here's a slice of Perl code to do this:
#!/usr/bin/perl -w
use Sys::Lastlog;
use vars qw( $login $port $host $when);
$ll = Sys::Lastlog->new();
$llent = $ll->getlluid(0);
$days = int((( time - $llent->ll_time() ) / 60 / 60 / 24));
print "days = $days\n";
exit;
Thanks to all, and I'll be more clear on my next request... :)
Thanks!
Steve B.
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers
This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 23:24:39 EDT