[LON-CAPA-cvs] cvs: loncom(version_2_11_X) / loncron
raeburn
raeburn at source.lon-capa.org
Thu Oct 24 18:24:26 EDT 2024
raeburn Thu Oct 24 22:24:26 2024 EDT
Modified files: (Branch: version_2_11_X)
/loncom loncron
Log:
- For 2.11
Backport 1.134, 1.135 (part), 1.136
Index: loncom/loncron
diff -u loncom/loncron:1.103.2.16 loncom/loncron:1.103.2.17
--- loncom/loncron:1.103.2.16 Sun Jul 28 23:52:11 2024
+++ loncom/loncron Thu Oct 24 22:24:26 2024
@@ -2,7 +2,7 @@
# Housekeeping program, started by cron, loncontrol and loncron.pl
#
-# $Id: loncron,v 1.103.2.16 2024/07/28 23:52:11 raeburn Exp $
+# $Id: loncron,v 1.103.2.17 2024/10/24 22:24:26 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -307,7 +307,7 @@
sub start_logging {
my $fh=IO::File->new(">$statusdir/newstatus.html");
- my %simplestatus=();
+ %simplestatus=();
my $now=time;
my $date=localtime($now);
@@ -968,11 +968,15 @@
rename("$statusdir/newstatus.html","$statusdir/index.html");
my $sfh=IO::File->new(">$statusdir/loncron_simple.txt");
- foreach (keys %simplestatus) {
- print $sfh $_.'='.$simplestatus{$_}.'&';
+ if (defined($sfh)) {
+ foreach my $key (keys(%simplestatus)) {
+ print $sfh $key.'='.$simplestatus{$key}.'&';
+ }
+ print $sfh "\n";
+ $sfh->close();
+ } else {
+ print "Could not write to $statusdir/loncron_simple.txt\n";
}
- print $sfh "\n";
- $sfh->close();
}
sub write_loncaparevs {
@@ -998,10 +1002,12 @@
}
}
if ($output) {
- if (open(my $fh,">$perlvar{'lonTabDir'}/loncaparevs.tab")) {
+ if (open(my $fh,'>',"$perlvar{'lonTabDir'}/loncaparevs.tab")) {
print $fh $output;
close($fh);
&Apache::lonnet::load_loncaparevs();
+ } else {
+ print "Could not write to $perlvar{'lonTabDir'}/loncaparevs.tab\n";
}
}
return;
@@ -1034,10 +1040,12 @@
}
}
if ($output) {
- if (open(my $fh,">$perlvar{'lonTabDir'}/serverhomeIDs.tab")) {
+ if (open(my $fh,'>',"$perlvar{'lonTabDir'}/serverhomeIDs.tab")) {
print $fh $output;
close($fh);
&Apache::lonnet::load_serverhomeIDs();
+ } else {
+ print "Could not write to $perlvar{'lonTabDir'}/serverhomeIDs.tab\n";
}
}
return;
@@ -1098,6 +1106,8 @@
}
close($fh);
chmod(0644,$newfile);
+ } else {
+ print "Could not write to $lontabdir/currhostips.tab\n";
}
}
if (keys(%prevhosts) && keys(%currhosts)) {
@@ -1123,6 +1133,8 @@
}
print $fh "\n*******************\n\n";
close($fh);
+ } else {
+ print "Could not write to $perlvar{'lonDaemons'}/logs/hostip.log\n";
}
my $emailto = &Apache::loncommon::build_recipient_list(undef,
'hostipmail',$defdom);
@@ -1438,7 +1450,7 @@
"Subject: ".$subj."\n".
"Content-type: text/html\; charset=UTF-8\n".
"MIME-Version: 1.0\n\n";
- if (open(my $fh,"<$statusdir/index.html")) {
+ if (open(my $fh,'<',"$statusdir/index.html")) {
while (<$fh>) {
$loncronmail .= $_;
}
@@ -1554,7 +1566,7 @@
my $now = time;
my $tmpfile = $perlvar{'lonDaemons'}.'/tmp/lciptables_iphost_'.
$now.$$.int(rand(10000));
- if (open(my $fh,">$tmpfile")) {
+ if (open(my $fh,'>',"$tmpfile")) {
my %iphosts = &Apache::lonnet::get_iphost();
foreach my $key (keys(%iphosts)) {
print $fh "$key\n";
More information about the LON-CAPA-cvs
mailing list