version 1.136, 2024/10/24 21:24:43
|
version 1.137, 2024/12/25 02:32:47
|
Line 134 sub checkon_daemon {
|
Line 134 sub checkon_daemon {
|
} |
} |
|
|
my $pidfile="$perlvar{'lonDaemons'}/logs/$daemon.pid"; |
my $pidfile="$perlvar{'lonDaemons'}/logs/$daemon.pid"; |
|
|
my $restartflag=1; |
my $restartflag=1; |
my $daemonpid; |
my $daemonpid; |
if (-e $pidfile) { |
if (-e $pidfile) { |
Line 206 sub checkon_daemon {
|
Line 206 sub checkon_daemon {
|
if (-e "$perlvar{'lonDaemons'}/logs/$daemon.log"){ |
if (-e "$perlvar{'lonDaemons'}/logs/$daemon.log"){ |
&log($fh,"<p><pre>"); |
&log($fh,"<p><pre>"); |
if (open(DFH,"tail -n100 $perlvar{'lonDaemons'}/logs/$daemon.log|")) { |
if (open(DFH,"tail -n100 $perlvar{'lonDaemons'}/logs/$daemon.log|")) { |
while (my $line=<DFH>) { |
while (my $line=<DFH>) { |
&log($fh,"$line"); |
&log($fh,"$line"); |
if ($line=~/WARNING/) { $notices++; } |
if ($line=~/WARNING/) { $notices++; } |
if ($line=~/CRITICAL/) { $notices++; } |
if ($line=~/CRITICAL/) { $notices++; } |
Line 249 sub log_machine_info {
|
Line 249 sub log_machine_info {
|
open (LOADAVGH,"/proc/loadavg"); |
open (LOADAVGH,"/proc/loadavg"); |
my $loadavg=<LOADAVGH>; |
my $loadavg=<LOADAVGH>; |
close (LOADAVGH); |
close (LOADAVGH); |
|
|
&log($fh,"<tt>$loadavg</tt>"); |
&log($fh,"<tt>$loadavg</tt>"); |
|
|
my @parts=split(/\s+/,$loadavg); |
my @parts=split(/\s+/,$loadavg); |
Line 312 sub start_logging {
|
Line 312 sub start_logging {
|
%simplestatus=(); |
%simplestatus=(); |
my $now=time; |
my $now=time; |
my $date=localtime($now); |
my $date=localtime($now); |
|
|
|
|
&log($fh,(<<ENDHEADERS)); |
&log($fh,(<<ENDHEADERS)); |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
Line 426 sub recursive_clean_tmp {
|
Line 426 sub recursive_clean_tmp {
|
} else { |
} else { |
$innerdir = $subdir.'/'.$file; |
$innerdir = $subdir.'/'.$file; |
} |
} |
($cleaned,$old,$removed) = |
($cleaned,$old,$removed) = |
&recursive_clean_tmp($innerdir,$cleaned,$old,$removed,$errors); |
&recursive_clean_tmp($innerdir,$cleaned,$old,$removed,$errors); |
my @doms = &Apache::lonnet::current_machine_domains(); |
my @doms = &Apache::lonnet::current_machine_domains(); |
|
|
Line 472 sub recursive_clean_tmp {
|
Line 472 sub recursive_clean_tmp {
|
if ($line=~/^CHECKOUTTOKEN\&/) { |
if ($line=~/^CHECKOUTTOKEN\&/) { |
if ($since>365*$perlvar{'lonExpire'}) { |
if ($since>365*$perlvar{'lonExpire'}) { |
if (unlink($fname)) { |
if (unlink($fname)) { |
$cleaned++; |
$cleaned++; |
} elsif (ref($errors->{file}) eq 'ARRAY') { |
} elsif (ref($errors->{file}) eq 'ARRAY') { |
push(@{$errors->{file}},$fname); |
push(@{$errors->{file}},$fname); |
} |
} |
Line 638 sub clean_sockets {
|
Line 638 sub clean_sockets {
|
my $cleaned=0; |
my $cleaned=0; |
opendir(SOCKETS,$perlvar{'lonSockDir'}); |
opendir(SOCKETS,$perlvar{'lonSockDir'}); |
while (my $fname=readdir(SOCKETS)) { |
while (my $fname=readdir(SOCKETS)) { |
next if (-d $fname |
next if (-d $fname |
|| $fname=~/(mysqlsock|maximasock|rsock|\Q$perlvar{'lonSockDir'}\E)/); |
|| $fname=~/(mysqlsock|maximasock|rsock|\Q$perlvar{'lonSockDir'}\E)/); |
$cleaned++; |
$cleaned++; |
&log($fh,"Unlinking $fname<br />"); |
&log($fh,"Unlinking $fname<br />"); |
Line 745 sub check_delayed_msg {
|
Line 745 sub check_delayed_msg {
|
my ($fh,$weightsref,$exclusionsref)=@_; |
my ($fh,$weightsref,$exclusionsref)=@_; |
&log($fh,'<hr /><a name="delayed" /><h2>Delayed Messages</h2>'); |
&log($fh,'<hr /><a name="delayed" /><h2>Delayed Messages</h2>'); |
print "Checking buffers.\n"; |
print "Checking buffers.\n"; |
|
|
&log($fh,'<h3>Scanning Permanent Log</h3>'); |
&log($fh,'<h3>Scanning Permanent Log</h3>'); |
|
|
my $unsend=0; |
my $unsend=0; |
Line 816 sub check_delayed_msg {
|
Line 816 sub check_delayed_msg {
|
last; |
last; |
} |
} |
undef $dfh; |
undef $dfh; |
} |
} |
|
|
if ($checkbackwards) { |
if ($checkbackwards) { |
if (tie *BW, 'File::ReadBackwards', "$perlvar{'lonDaemons'}/logs/lonnet.perm.log") { |
if (tie *BW, 'File::ReadBackwards', "$perlvar{'lonDaemons'}/logs/lonnet.perm.log") { |
Line 996 sub finish_logging {
|
Line 996 sub finish_logging {
|
|
|
sub log_simplestatus { |
sub log_simplestatus { |
rename("$statusdir/newstatus.html","$statusdir/index.html"); |
rename("$statusdir/newstatus.html","$statusdir/index.html"); |
|
|
my $sfh=IO::File->new(">$statusdir/loncron_simple.txt"); |
my $sfh=IO::File->new(">$statusdir/loncron_simple.txt"); |
if (defined($sfh)) { |
if (defined($sfh)) { |
foreach my $key (keys(%simplestatus)) { |
foreach my $key (keys(%simplestatus)) { |
Line 1024 sub write_loncaparevs {
|
Line 1024 sub write_loncaparevs {
|
alarm(0); |
alarm(0); |
}; |
}; |
if ($@ && $@ =~ m/TIMEOUT/) { |
if ($@ && $@ =~ m/TIMEOUT/) { |
print "Time out while contacting lonHost: $id for version.\n"; |
print "Time out while contacting lonHost: $id for version.\n"; |
} |
} |
if ($loncaparev =~ /^[\w.\-]+$/) { |
if ($loncaparev =~ /^[\w.\-]+$/) { |
$output .= $id.':'.$loncaparev."\n"; |
$output .= $id.':'.$loncaparev."\n"; |
Line 1037 sub write_loncaparevs {
|
Line 1037 sub write_loncaparevs {
|
close($fh); |
close($fh); |
&Apache::lonnet::load_loncaparevs(); |
&Apache::lonnet::load_loncaparevs(); |
} else { |
} else { |
print "Could not write to $perlvar{'lonTabDir'}/loncaparevs.tab\n"; |
print "Could not write to $perlvar{'lonTabDir'}/loncaparevs.tab\n"; |
} |
} |
} |
} |
return; |
return; |
Line 1059 sub write_serverhomeIDs {
|
Line 1059 sub write_serverhomeIDs {
|
alarm(0); |
alarm(0); |
}; |
}; |
if ($@ && $@ =~ m/TIMEOUT/) { |
if ($@ && $@ =~ m/TIMEOUT/) { |
print "Time out while contacting server: $name\n"; |
print "Time out while contacting server: $name\n"; |
} |
} |
if ($serverhomeID ne '') { |
if ($serverhomeID ne '') { |
$output .= $name.':'.$serverhomeID."\n"; |
$output .= $name.':'.$serverhomeID."\n"; |
Line 1096 sub write_checksums {
|
Line 1096 sub write_checksums {
|
} |
} |
print "File version retrieved and checksumming completed for $numchksums files.\n"; |
print "File version retrieved and checksumming completed for $numchksums files.\n"; |
} else { |
} else { |
print "File version retrieval and checksumming skipped - could not determine Linux distro.\n"; |
print "File version retrieval and checksumming skipped - could not determine Linux distro.\n"; |
} |
} |
return; |
return; |
} |
} |
Line 1240 sub write_connection_config {
|
Line 1240 sub write_connection_config {
|
} |
} |
} |
} |
if (keys(%connectssl)) { |
if (keys(%connectssl)) { |
my %currconf; |
my %currconf; |
if (open(my $fh,'<',"$perlvar{'lonTabDir'}/connectionrules.tab")) { |
if (open(my $fh,'<',"$perlvar{'lonTabDir'}/connectionrules.tab")) { |
while (my $line = <$fh>) { |
while (my $line = <$fh>) { |
chomp($line); |
chomp($line); |
Line 1255 sub write_connection_config {
|
Line 1255 sub write_connection_config {
|
} |
} |
if (open(my $fh,'>',"$perlvar{'lonTabDir'}/connectionrules.tab")) { |
if (open(my $fh,'>',"$perlvar{'lonTabDir'}/connectionrules.tab")) { |
my $count = 0; |
my $count = 0; |
foreach my $key (sort(keys(%connectssl))) { |
foreach my $key (sort(keys(%connectssl))) { |
print $fh "$key=$connectssl{$key}\n"; |
print $fh "$key=$connectssl{$key}\n"; |
if (exists($currconf{$key})) { |
if (exists($currconf{$key})) { |
unless ($currconf{$key} eq $connectssl{$key}) { |
unless ($currconf{$key} eq $connectssl{$key}) { |
Line 1538 sub check_bash_settings {
|
Line 1538 sub check_bash_settings {
|
$bracketed_warning = 1; |
$bracketed_warning = 1; |
} |
} |
} else { |
} else { |
print "Unable to check if bracketed paste is set to off for www user's shell\n"; |
print "Unable to check if bracketed paste is set to off for www user's shell\n"; |
} |
} |
} |
} |
return ($bracketed_warning,$check_bracketed_paste); |
return ($bracketed_warning,$check_bracketed_paste); |
Line 1682 sub send_mail {
|
Line 1682 sub send_mail {
|
"Subject: ".$subj."\n". |
"Subject: ".$subj."\n". |
"Content-type: text/html\; charset=UTF-8\n". |
"Content-type: text/html\; charset=UTF-8\n". |
"MIME-Version: 1.0\n\n"; |
"MIME-Version: 1.0\n\n"; |
if (open(my $fh,'<',$statusdir/index.html")) { |
if (open(my $fh,'<',"$statusdir/index.html")) { |
while (<$fh>) { |
while (<$fh>) { |
$loncronmail .= $_; |
$loncronmail .= $_; |
} |
} |
Line 1705 sub usage {
|
Line 1705 sub usage {
|
loncron - housekeeping program that checks up on various parts of LON-CAPA |
loncron - housekeeping program that checks up on various parts of LON-CAPA |
|
|
Options: |
Options: |
--help Display |
--help Display |
--noemail Do not send the status email |
--noemail Do not send the status email |
--justcheckconnections Only check the current status of the lonc/d |
--justcheckconnections Only check the current status of the lonc/d |
connections, do not send emails do not |
connections, do not send emails do not |
Line 1848 sub main () {
|
Line 1848 sub main () {
|
&clean_nosslverify($fh); |
&clean_nosslverify($fh); |
&write_connection_config(); |
&write_connection_config(); |
&write_hosttypes(); |
&write_hosttypes(); |
&update_revocation_list(); |
&update_revocation_list(); |
&checkon_daemon($fh,'lond',40000,'USR2'); |
&checkon_daemon($fh,'lond',40000,'USR2'); |
&checkon_daemon($fh,'lonc',40000,'USR2'); |
&checkon_daemon($fh,'lonc',40000,'USR2'); |
} |
} |
Line 1876 sub main () {
|
Line 1876 sub main () {
|
&log($fh,'<p>'.$bash_update.'</p>'."\n"); |
&log($fh,'<p>'.$bash_update.'</p>'."\n"); |
} |
} |
} else { |
} else { |
&log($fh,'<p>No action needed; /home/www/.inputrc already set.</p>'."\n"); |
&log($fh,'<p>No action needed; /home/www/.inputrc already set.</p>'."\n"); |
} |
} |
} else { |
} else { |
&log($fh,'<hr /><a name="bashconf" /><h2>bash readline config</h2><h3>Bracketed Paste</h3>'. |
&log($fh,'<hr /><a name="bashconf" /><h2>bash readline config</h2><h3>Bracketed Paste</h3>'. |