- 論壇徽章:
- 0
|
原帖由 飄散在風(fēng)里 于 2006-8-3 17:43 發(fā)表
my $logfile="mylog_${HOUR}.log "
open (FP,"tail -f $logfile |") || die "open file error:$!\n";
while (<FP>) {
...
}
$logfile會每隔一小時變成另一個文 ...
man tail:
--retry
keep trying to open a file even if it is inaccessible when tail
starts or if it becomes inaccessible later -- useful only with
-f
Give a try on '--retry' option?
Or maybe you would monitor the 'FP' filehandle (ie. using 'IO::Select'),when you can't read from this handle for some times,you re-open the 'tail' pipe.
Hope this helps. |
|