version 1.37, 2003/08/08 12:38:00
|
version 1.40, 2003/09/26 00:23:09
|
Line 77 use POSIX qw(strftime mktime);
|
Line 77 use POSIX qw(strftime mktime);
|
my @metalist; |
my @metalist; |
|
|
$simplestatus=''; |
$simplestatus=''; |
|
my %countext=(); |
|
|
sub writesimple { |
sub writesimple { |
open(SMP,'>/home/httpd/html/lon-status/mysql.txt'); |
open(SMP,'>/home/httpd/html/lon-status/mysql.txt'); |
Line 84 sub writesimple {
|
Line 85 sub writesimple {
|
close(SMP); |
close(SMP); |
} |
} |
|
|
|
sub writecount { |
|
open(RSMP,'>/home/httpd/html/lon-status/rescount.txt'); |
|
foreach (keys %countext) { |
|
print RSMP $_.'='.$countext{$_}.'&'; |
|
} |
|
print RSMP 'time='.time."\n"; |
|
close(RSMP); |
|
} |
|
|
|
sub count { |
|
my $file=shift; |
|
$file=~/\.(\w+)$/; |
|
my $ext=lc($1); |
|
if (defined($countext{$ext})) { |
|
$countext{$ext}++; |
|
} else { |
|
$countext{$ext}=1; |
|
} |
|
} |
# ----------------------------------------------------- Un-Escape Special Chars |
# ----------------------------------------------------- Un-Escape Special Chars |
|
|
sub unescape { |
sub unescape { |
Line 287 foreach my $user (@homeusers) {
|
Line 307 foreach my $user (@homeusers) {
|
foreach my $m (@metalist) { |
foreach my $m (@metalist) { |
print LOG "- ".$m."\n"; |
print LOG "- ".$m."\n"; |
my $ref=&metadata($m); |
my $ref=&metadata($m); |
|
if ($ref->{'obsolete'}) { print LOG "obsolete\n"; next; } |
|
if ($ref->{'copyright'} eq 'private') { print LOG "private\n"; next; } |
my $m2='/res/'.&declutter($m); |
my $m2='/res/'.&declutter($m); |
$m2=~s/\.meta$//; |
$m2=~s/\.meta$//; |
&dynamicmeta($m2); |
# &dynamicmeta($m2); |
|
&count($m2); |
$delete_sth->execute($m2); |
$delete_sth->execute($m2); |
$insert_sth->execute($ref->{'title'}, |
$insert_sth->execute($ref->{'title'}, |
$ref->{'author'}, |
$ref->{'author'}, |
Line 319 foreach my $user (@homeusers) {
|
Line 342 foreach my $user (@homeusers) {
|
# |
# |
# Check the size of nohist_new_resevaldata.db compared to |
# Check the size of nohist_new_resevaldata.db compared to |
# nohist_resevaldata.db |
# nohist_resevaldata.db |
my @stat_result = stat($prodir.'/nohist_new_resevaldata.db'); |
# my @stat_result = stat($prodir.'/nohist_new_resevaldata.db'); |
my $new_size = $stat_result[7]; |
# my $new_size = $stat_result[7]; |
@stat_result = stat($prodir.'/nohist_resevaldata.db'); |
# @stat_result = stat($prodir.'/nohist_resevaldata.db'); |
my $old_size = $stat_result[7]; |
# my $old_size = $stat_result[7]; |
if ($new_size/$old_size > 0.15 ) { |
# if ($old_size) { |
system('mv '.$prodir.'/nohist_new_resevaldata.db '. |
# if ($new_size/$old_size > 0.15 ) { |
$prodir.'/nohist_resevaldata.db'); |
# system('mv '.$prodir.'/nohist_new_resevaldata.db '. |
} else { |
# $prodir.'/nohist_resevaldata.db'); |
print LOG "Size of '$user' old nohist_reseval: $old_size ". |
# } else { |
"Size of new: $new_size. Not overwriting.\n"; |
# print LOG "Size of '$user' old nohist_reseval: $old_size ". |
my $emailto="$perlvar{'lonAdmEMail'},$perlvar{'lonSysEMail'}"; |
# "Size of new: $new_size. Not overwriting.\n"; |
my $subj="LON: $perlvar{'lonHostID'} searchcat.pl $user reseval ". |
# my $emailto="$perlvar{'lonAdmEMail'},$perlvar{'lonSysEMail'}"; |
"modification error."; |
# my $subj="LON: $perlvar{'lonHostID'} searchcat.pl $user reseval ". |
system("echo ". |
# "modification error."; |
"'See /home/httpd/perl/logs/searchcat.txt for information.' ". |
# system("echo ". |
"| mailto $emailto -s '$subj' > /dev/null"); |
# "'See /home/httpd/perl/logs/searchcat.txt for information.' ". |
} |
# "| mailto $emailto -s '$subj' > /dev/null"); |
|
# } |
|
# } |
} |
} |
# --------------------------------------------------- Close database connection |
# --------------------------------------------------- Close database connection |
$dbh->disconnect; |
$dbh->disconnect; |
print LOG "\n==== Searchcat completed ".localtime()." ====\n"; |
print LOG "\n==== Searchcat completed ".localtime()." ====\n"; |
close(LOG); |
close(LOG); |
&writesimple(); |
&writesimple(); |
|
&writecount(); |
exit 0; |
exit 0; |
|
|
|
|