- 论坛徽章:
- 0
|
原帖由 飘散在风里 于 2006-8-3 17:43 发表
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. |
|