version 1.118, 2019/03/18 00:37:37
|
version 1.120, 2020/01/11 21:54:31
|
Line 567 sub clean_webDAV_sessionIDs {
|
Line 567 sub clean_webDAV_sessionIDs {
|
} |
} |
} |
} |
|
|
|
# ------------------------------------------------------------ clean out ltiIDs |
|
|
|
sub clean_ltiIDs { |
|
my ($fh)=@_; |
|
&log($fh,'<hr /><a name="ltisessions" /><h2>LTI Session Pointers</h2>'); |
|
my $cleaned=0; |
|
my $active=0; |
|
if (-d $perlvar{'ltiIDsDir'}) { |
|
while (my $fname=<$perlvar{'ltiIDsDir'}/*>) { |
|
my ($dev,$ino,$mode,$nlink, |
|
$uid,$gid,$rdev,$size, |
|
$atime,$mtime,$ctime, |
|
$blksize,$blocks)=stat($fname); |
|
my $now=time; |
|
my $since=$now-$mtime; |
|
if ($since>$perlvar{'lonExpire'}) { |
|
$cleaned++; |
|
&log($fh,"Unlinking $fname<br />"); |
|
unlink("$fname"); |
|
} else { |
|
$active++; |
|
} |
|
} |
|
} |
|
&log($fh,"<p>Cleaned up ".$cleaned." old LTI session pointers.</p>"); |
|
&log($fh,"<h3>$active unexpired LTI session pointers</h3>"); |
|
} |
|
|
# ----------------------------------------------------------- clean out sockets |
# ----------------------------------------------------------- clean out sockets |
sub clean_sockets { |
sub clean_sockets { |
my ($fh)=@_; |
my ($fh)=@_; |
Line 1068 sub write_hostips {
|
Line 1096 sub write_hostips {
|
if (keys(%prevhosts) && keys(%currhosts)) { |
if (keys(%prevhosts) && keys(%currhosts)) { |
foreach my $key (keys(%prevhosts)) { |
foreach my $key (keys(%prevhosts)) { |
unless ($currhosts{$key} eq $prevhosts{$key}) { |
unless ($currhosts{$key} eq $prevhosts{$key}) { |
$ipchange{$key} = $prevhosts{$key}.'|'.$currhosts{$key}; |
$ipchange{$key} = $prevhosts{$key}.' | '.$currhosts{$key}.' |'; |
} |
} |
} |
} |
foreach my $key (keys(%currhosts)) { |
foreach my $key (keys(%currhosts)) { |
unless ($currhosts{$key} eq $prevhosts{$key}) { |
unless ($currhosts{$key} eq $prevhosts{$key}) { |
$ipchange{$key} = $prevhosts{$key}.' | '.$currhosts{$key}; |
$ipchange{$key} = $prevhosts{$key}.' | '.$currhosts{$key}.' |'; |
} |
} |
} |
} |
} |
} |
Line 1081 sub write_hostips {
|
Line 1109 sub write_hostips {
|
if (keys(%ipchange)) { |
if (keys(%ipchange)) { |
if (open(my $fh,'>>',$perlvar{'lonDaemons'}.'/logs/hostip.log')) { |
if (open(my $fh,'>>',$perlvar{'lonDaemons'}.'/logs/hostip.log')) { |
print $fh "********************\n".localtime(time).' Changes --'."\n". |
print $fh "********************\n".localtime(time).' Changes --'."\n". |
"Hostname | Previous IP | New IP\n". |
"Hostname | Previous IP | New IP |\n". |
"--------------------------------\n"; |
"--------------------------------\n"; |
foreach my $hostname (sort(keys(%ipchange))) { |
foreach my $hostname (sort(keys(%ipchange))) { |
print $fh "$hostname | $ipchange{$hostname}\n"; |
print $fh "$hostname | $ipchange{$hostname}\n"; |
Line 1099 sub write_hostips {
|
Line 1127 sub write_hostips {
|
"MIME-Version: 1.0\n\n". |
"MIME-Version: 1.0\n\n". |
"Host/IP changes\n". |
"Host/IP changes\n". |
" \n". |
" \n". |
"Hostname | Previous IP | New IP\n". |
"Hostname | Previous IP | New IP |\n". |
"--------------------------------\n"; |
"--------------------------------\n"; |
foreach my $hostname (sort(keys(%ipchange))) { |
foreach my $hostname (sort(keys(%ipchange))) { |
$chgmail .= "$hostname | $ipchange{$hostname}\n"; |
$chgmail .= "$hostname | $ipchange{$hostname}\n"; |
Line 1595 sub main () {
|
Line 1623 sub main () {
|
&clean_lonIDs($fh); |
&clean_lonIDs($fh); |
&clean_balanceIDs($fh); |
&clean_balanceIDs($fh); |
&clean_webDAV_sessionIDs($fh); |
&clean_webDAV_sessionIDs($fh); |
|
&clean_ltiIDs($fh); |
&check_httpd_logs($fh); |
&check_httpd_logs($fh); |
&rotate_lonnet_logs($fh); |
&rotate_lonnet_logs($fh); |
&rotate_other_logs($fh); |
&rotate_other_logs($fh); |