我有一个可以读取日志的脚本。日志的前三个字符是该客户的代码(即 xxx)。程序启动并运行,然后停止并出现此错误。out.txt 位于所有客户的日志目录中,直到某个客户。这个具有与其他所有相同的权限。该程序停止,并且该客户之后没有任何东西获得该文件。
$adminDir = "/data1/Scripts";
$scriptDir = "/data1/Scripts";
chomp($toDay = `date +%m-%d-%y`);
@prodDirs = ();
open(DIRS, "$scriptDir/production_dirs") or warn "Can't open $scriptDir/production_dirs file: $!\n";
$count = 0;
while (<DIRS>) {
if(index($_, '#') < 0) {
chomp($prodDirs[$count++] = $_);
}
}
close(DIRS);
foreach $jobDir (@prodDirs) {
@dirFields = split(/\|/, $jobDir);
$srcDir = $dirFields[0];
$workDir = "$srcDir";
$logFile = $workDir . "/log/" . $dirFields[11] . "log";
$oldLog = $logFile;
$oldLogBack = $oldLog . "." . $toDay;
$newLog = $workDir . "/log/" . "out.txt";
open(FILE, "<$logFile")|| die "Can't open input file $!";
open(OUT, ">$newLog") || die "Can't open output file $!";
while(<FILE>) {
print OUT if($_=~/(.*)(Jan 1)(.*?)/gs);
}
}