You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Princeton/pu/libexec/check_tws_stdlistsz.pl

52 lines
917 B
Perl

#!/usr/bin/perl
$THRESH = 20 * 1024 * 1024;
$path = "/maestro/app/stdlist";
opendir(STDLIST, $path);
$filetime = 0;
while ($dir = readdir(STDLIST)) {
next if ($dir !~ /^\d\d\d\d\.\d\d\.\d\d$/);
# print "$dir\n";
@sbuf = stat "$path/$dir";
if ($sbuf[9] > $filetime) {
$filetime = $sbuf[9];
$newest = $dir;
}
}
closedir(STDLIST);
# print "newest: $newest, time = $filetime\n";
opendir(NEWEST, "$path/$newest");
while ($file = readdir(NEWEST)) {
next if $file eq "." || $file eq "..";
@sbuf = stat "$path/$newest/$file";
# print "$file $sbuf[7]\n";
if ($sbuf[7] > $THRESH) {
push @list, "$newest/$file";
push @sizes, $sbuf[7];
}
}
closedir(NEWEST);
$numfiles = scalar(@list);
if ($numfiles > 0) {
print "WARNING: large stdlist files: ";
for ($i = 0; $i < $numfiles; $i++) {
print "$list[$i]($sizes[$i]) ";
}
print "\n";
exit 1;
}
else {
print "OK stdlist sizes normal\n";
exit 0;
}