[LON-CAPA-cvs] cvs: loncom / loncron

raeburn raeburn at source.lon-capa.org
Thu Oct 24 15:48:51 EDT 2024


raeburn		Thu Oct 24 19:48:51 2024 EDT

  Modified files:              
    /loncom	loncron 
  Log:
  - %simplestatus is a global.
  - Check file handle for writing to loncron_simple.txt is defined.
  - Coding style: eliminate use of $_ in log_simplestatus().
  
  
Index: loncom/loncron
diff -u loncom/loncron:1.133 loncom/loncron:1.134
--- loncom/loncron:1.133	Sun Jul 28 23:49:32 2024
+++ loncom/loncron	Thu Oct 24 19:48:51 2024
@@ -2,7 +2,7 @@
 
 # Housekeeping program, started by cron, loncontrol and loncron.pl
 #
-# $Id: loncron,v 1.133 2024/07/28 23:49:32 raeburn Exp $
+# $Id: loncron,v 1.134 2024/10/24 19:48:51 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -309,7 +309,7 @@
 
 sub start_logging {
     my $fh=IO::File->new(">$statusdir/newstatus.html");
-    my %simplestatus=();
+    %simplestatus=();
     my $now=time;
     my $date=localtime($now);
  
@@ -998,11 +998,13 @@
     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();
     }
-    print $sfh "\n";
-    $sfh->close();
 }
 
 sub write_loncaparevs {




More information about the LON-CAPA-cvs mailing list