lost_in_space has asked for the wisdom of the Perl Monks concerning the following question:
_________________________________________ OUTPUT LOOKS LIKE THIS:#!/usr/local/bin/perl print $template = "A8 A4 A12 l s s s s l a16 l"; $recordsize = length(pack($template,( ))); open(WTMP,"/var/adm/wtmp") or die "Unable to open wtmp:$!\n"; while (read(WTMP,$record,$recordsize)) { ($user,$ttyid,$tty,$pid,$type,$term,$exit,$host,$time,$hostip) +=unpack ($template,$record); next unless $type == 7; next unless $ttyid; next if $ttyid eq "ftp"; next if $ttyid=~/\d+:\d+/; $user=~y/\000//d; $ttyid=~y/\000//d; $tty=~y/\000//d; $host=~y +/\000//d; $hold{$user}=$time if $time >$hold{$user}; } $over365=time()-365*24*60*60; foreach $user (keys %hold) { if ($hold{$user} < $over365) { printf( "%12s %d\n", $user, $ho +ld{$user} ); } };
A8 A4 A12 l s s s s l a16 l kileykl 1043180949 romanst 1042640335 hallchar 1033636020 orsjrg 1035913589 dindiala 1035210784 smithpau 1045754579 orsbll 1042571980 orsmjr 1043676426 orsawb 1036078160
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Issues with wtmp
by Steve_p (Priest) on Mar 31, 2004 at 20:53 UTC | |
|
Re: Issues with wtmp
by BrowserUk (Patriarch) on Mar 31, 2004 at 20:58 UTC |