version 1.82, 2009/11/26 00:18:09
|
version 1.85, 2010/07/20 02:42:27
|
Line 564 sub rotate_lonnet_logs {
|
Line 564 sub rotate_lonnet_logs {
|
|
|
sub rotate_other_logs { |
sub rotate_other_logs { |
my ($fh) = @_; |
my ($fh) = @_; |
my $fname="$perlvar{'lonDaemons'}/logs/autoenroll.log"; |
my %logs = ( |
&rotate_logfile($fname,$fh,'Auto Enroll log'); |
autoenroll => 'Auto Enroll log', |
$fname="$perlvar{'lonDaemons'}/logs/autocreate.log"; |
autocreate => 'Create Course log', |
&rotate_logfile($fname,$fh,'Create Course log'); |
searchcat => 'Search Cataloguing log', |
$fname="$perlvar{'lonDaemons'}/logs/searchcat.log"; |
autoupdate => 'Auto Update log', |
&rotate_logfile($fname,$fh,'Search Cataloguing log'); |
refreshcourseids_db => 'Refresh CourseIDs db log', |
|
); |
|
foreach my $item (keys(%logs)) { |
|
my $fname=$perlvar{'lonDaemons'}.'/logs/'.$item.'.log'; |
|
&rotate_logfile($fname,$fh,$logs{$item}); |
|
} |
} |
} |
|
|
# ----------------------------------------------------------------- Connections |
# ----------------------------------------------------------------- Connections |
Line 680 sub log_simplestatus {
|
Line 685 sub log_simplestatus {
|
$sfh->close(); |
$sfh->close(); |
} |
} |
|
|
|
sub write_loncaparevs { |
|
if (open(my $fh,">$perlvar{'lonTabDir'}/loncaparevs.tab")) { |
|
my %hostname = &Apache::lonnet::all_hostnames(); |
|
foreach my $id (sort(keys(%hostname))) { |
|
if ($id ne '') { |
|
my $loncaparev = &Apache::lonnet::get_server_loncaparev('',$id,1,'loncron'); |
|
if ($loncaparev =~ /^[\d.\-]+$/) { |
|
print $fh $id.':'.$loncaparev."\n"; |
|
} |
|
} |
|
} |
|
close($fh); |
|
} |
|
return; |
|
} |
|
|
|
sub write_serverhomeIDs { |
|
if (open(my $fh,">$perlvar{'lonTabDir'}/serverhomeIDs.tab")) { |
|
my %name_to_host = &Apache::lonnet::all_names(); |
|
foreach my $name (sort(keys(%name_to_host))) { |
|
if ($name ne '') { |
|
if (ref($name_to_host{$name}) eq 'ARRAY') { |
|
my $serverhomeID = &Apache::lonnet::get_server_homeID($name,1,'loncron'); |
|
if ($serverhomeID ne '') { |
|
print $fh $name.':'.$serverhomeID."\n"; |
|
} else { |
|
print $fh $name.':'.$name_to_host{$name}->[0]."\n"; |
|
} |
|
} |
|
} |
|
} |
|
close($fh); |
|
} |
|
return; |
|
} |
|
|
sub send_mail { |
sub send_mail { |
print "sending mail\n"; |
print "sending mail\n"; |
my $defdom = $perlvar{'lonDefDomain'}; |
my $defdom = $perlvar{'lonDefDomain'}; |
Line 828 sub main () {
|
Line 869 sub main () {
|
|
|
if ($totalcount>200 && !$noemail) { &send_mail(); } |
if ($totalcount>200 && !$noemail) { &send_mail(); } |
} |
} |
|
if (!$justcheckconnections && !$justreload) { |
|
&write_loncaparevs(); |
|
&write_serverhomeIDs(); |
|
} |
} |
} |
|
|
&main(); |
&main(); |