---Source --- #!/usr/bin/perl -w use strict; use File::Tail; $|=1; my @ports = (10290,10291,10292,10293,10294,10295,10298); my @logs; foreach my $port (@ports) { my $file = "/usr/local/qpxlocal/log/act*" . $port . ".log"; my @files = `/bin/ls -r $file`; if($files[0] ne "") { chomp $files[0]; push(@logs,$files[0]); print "Push $files[0]\n"; }else{ print "Log file for $port is missing!\n"; } } my @files_to_tail; my $debug; foreach (@logs) { push(@files_to_tail,File::Tail->new(name=>"$_",debug=>"1",maxinterval=>"1",i nterval=>"1", errmode=>"warn",reset_tail=>"-1")); } while(1) { my ($nfound,$timeleft,@pending)=File::Tail::select(undef,undef,undef,2,@file s_to_tail); unless($nfound) { my @ints; foreach(@files_to_tail) { push(@ints,$_->interval); } print "Nothing new in the past 1 seconds (" . join(",",@ints) . ")\n"; } foreach (@pending) { my $file_name = $_->{'input'}; my $read_data = $_->read; $file_name =~ /.+(\d{5})\.log/; my $port = $1; print "$port: $read_data";# unless $_->predict; } }