version 1.98, 2013/02/08 14:49:51
|
version 1.99, 2013/05/29 18:10:54
|
Line 695 sub log_simplestatus {
|
Line 695 sub log_simplestatus {
|
|
|
sub write_loncaparevs { |
sub write_loncaparevs { |
print "Retrieving LON-CAPA version information\n"; |
print "Retrieving LON-CAPA version information\n"; |
if (open(my $fh,">$perlvar{'lonTabDir'}/loncaparevs.tab")) { |
my %hostname = &Apache::lonnet::all_hostnames(); |
my %hostname = &Apache::lonnet::all_hostnames(); |
my $output; |
foreach my $id (sort(keys(%hostname))) { |
foreach my $id (sort(keys(%hostname))) { |
if ($id ne '') { |
if ($id ne '') { |
my $loncaparev; |
my $loncaparev; |
|
eval { |
|
local $SIG{ ALRM } = sub { die "TIMEOUT" }; |
|
alarm(10); |
|
$loncaparev = |
|
&Apache::lonnet::get_server_loncaparev('',$id,1,'loncron'); |
|
alarm(0); |
|
}; |
|
if ($@ && $@ =~ m/TIMEOUT/) { |
|
print "time out while contacting lonHost: $id for version\n"; |
|
} |
|
if ($loncaparev =~ /^[\w.\-]+$/) { |
|
$output .= $id.':'.$loncaparev."\n"; |
|
} |
|
} |
|
} |
|
if ($output) { |
|
if (open(my $fh,">$perlvar{'lonTabDir'}/loncaparevs.tab")) { |
|
print $fh $output; |
|
close($fh); |
|
&Apache::lonnet::load_loncaparevs(); |
|
} |
|
} |
|
return; |
|
} |
|
|
|
sub write_serverhomeIDs { |
|
print "Retrieving LON-CAPA lonHostID information\n"; |
|
my %name_to_host = &Apache::lonnet::all_names(); |
|
my $output; |
|
foreach my $name (sort(keys(%name_to_host))) { |
|
if ($name ne '') { |
|
if (ref($name_to_host{$name}) eq 'ARRAY') { |
|
my $serverhomeID; |
eval { |
eval { |
local $SIG{ ALRM } = sub { die "TIMEOUT" }; |
local $SIG{ ALRM } = sub { die "TIMEOUT" }; |
alarm(10); |
alarm(10); |
$loncaparev = |
$serverhomeID = |
&Apache::lonnet::get_server_loncaparev('',$id,1,'loncron'); |
&Apache::lonnet::get_server_homeID($name,1,'loncron'); |
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 server: $name\n"; |
} |
} |
if ($loncaparev =~ /^[\w.\-]+$/) { |
if ($serverhomeID ne '') { |
print $fh $id.':'.$loncaparev."\n"; |
$output .= $name.':'.$serverhomeID."\n"; |
|
} else { |
|
$output .= $name.':'.$name_to_host{$name}->[0]."\n"; |
} |
} |
} |
} |
} |
} |
close($fh); |
|
} |
} |
return; |
if ($output) { |
} |
if (open(my $fh,">$perlvar{'lonTabDir'}/serverhomeIDs.tab")) { |
|
print $fh $output; |
sub write_serverhomeIDs { |
close($fh); |
print "Retrieving LON-CAPA lonHostID information\n"; |
&Apache::lonnet::load_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; |
|
eval { |
|
local $SIG{ ALRM } = sub { die "TIMEOUT" }; |
|
alarm(10); |
|
$serverhomeID = |
|
&Apache::lonnet::get_server_homeID($name,1,'loncron'); |
|
alarm(0); |
|
}; |
|
if ($@ && $@ =~ m/TIMEOUT/) { |
|
print "Time out while contacting server: $name\n"; |
|
} |
|
if ($serverhomeID ne '') { |
|
print $fh $name.':'.$serverhomeID."\n"; |
|
} else { |
|
print $fh $name.':'.$name_to_host{$name}->[0]."\n"; |
|
} |
|
} |
|
} |
|
} |
} |
close($fh); |
|
} |
} |
return; |
return; |
} |
} |