#!/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, $hold{$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