version 1.114, 2018/11/18 22:50:46
|
version 1.116, 2018/12/22 20:05:16
|
Line 34 use lib '/home/httpd/lib/perl/';
|
Line 34 use lib '/home/httpd/lib/perl/';
|
use LONCAPA::Configuration; |
use LONCAPA::Configuration; |
use LONCAPA::Checksumming; |
use LONCAPA::Checksumming; |
use LONCAPA; |
use LONCAPA; |
|
use LONCAPA::LWPReq; |
use Apache::lonnet; |
use Apache::lonnet; |
use Apache::loncommon; |
use Apache::loncommon; |
|
|
Line 511 sub clean_lonIDs {
|
Line 512 sub clean_lonIDs {
|
&log($fh,"<h3>$active open session(s)</h3>"); |
&log($fh,"<h3>$active open session(s)</h3>"); |
} |
} |
|
|
|
# -------------------------------------------------------- clean out balanceIDs |
|
|
|
sub clean_balanceIDs { |
|
my ($fh)=@_; |
|
&log($fh,'<hr /><a name="balcookies" /><h2>Session Tokens</h2>'); |
|
my $cleaned=0; |
|
my $active=0; |
|
if (-d $perlvar{'lonBalanceDir'}) { |
|
while (my $fname=<$perlvar{'balanceDir'}/*.id>) { |
|
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." stale balancer files</p>"); |
|
&log($fh,"<h3>$active unexpired balancer files</h3>"); |
|
} |
|
|
# ------------------------------------------------ clean out webDAV Session IDs |
# ------------------------------------------------ clean out webDAV Session IDs |
sub clean_webDAV_sessionIDs { |
sub clean_webDAV_sessionIDs { |
my ($fh)=@_; |
my ($fh)=@_; |
Line 1095 sub get_domain_config {
|
Line 1124 sub get_domain_config {
|
unless ($protocol eq 'https') { |
unless ($protocol eq 'https') { |
$protocol = 'http'; |
$protocol = 'http'; |
} |
} |
$url = $protocol.'://'.$hostname.'/cgi-bin/listdomconfig.pl'; |
$url = $protocol.'://'.$hostname.'/cgi-bin/listdomconfig.pl?primary='.$primlibserv.'&format=raw'; |
} |
} |
if ($isprimary) { |
if ($isprimary) { |
my $lonusersdir = $perlvar{'lonUsersDir'}; |
my $lonusersdir = $perlvar{'lonUsersDir'}; |
Line 1116 sub get_domain_config {
|
Line 1145 sub get_domain_config {
|
} |
} |
} |
} |
} else { |
} else { |
if (open(PIPE,"wget --no-check-certificate '$url?primary=$primlibserv&format=raw' |")) { |
my $request=new HTTP::Request('GET',$url); |
my $config = ''; |
my $response=&LONCAPA::LWPReq::makerequest($primlibserv,$request,'',\%perlvar,5); |
while (<PIPE>) { |
unless ($response->is_error()) { |
$config .= $_; |
my $content = $response->content; |
} |
if ($content) { |
close(PIPE); |
my @pairs=split(/\&/,$content); |
if ($config) { |
|
my @pairs=split(/\&/,$config); |
|
foreach my $item (@pairs) { |
foreach my $item (@pairs) { |
my ($key,$value)=split(/=/,$item,2); |
my ($key,$value)=split(/=/,$item,2); |
my $what = &LONCAPA::unescape($key); |
my $what = &LONCAPA::unescape($key); |
Line 1471 sub main () {
|
Line 1498 sub main () {
|
&log_machine_info($fh); |
&log_machine_info($fh); |
&clean_tmp($fh); |
&clean_tmp($fh); |
&clean_lonIDs($fh); |
&clean_lonIDs($fh); |
|
&clean_balanceIDs($fh); |
&clean_webDAV_sessionIDs($fh); |
&clean_webDAV_sessionIDs($fh); |
&check_httpd_logs($fh); |
&check_httpd_logs($fh); |
&rotate_lonnet_logs($fh); |
&rotate_lonnet_logs($fh); |