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

raeburn raeburn at source.lon-capa.org
Wed Oct 24 23:27:23 EDT 2018


raeburn		Thu Oct 25 03:27:23 2018 EDT

  Modified files:              
    /loncom	loncron 
  Log:
  - Skip tailing daemon logs when calling context does not update lon-status.     
  
  
Index: loncom/loncron
diff -u loncom/loncron:1.109 loncom/loncron:1.110
--- loncom/loncron:1.109	Thu Oct 25 02:48:56 2018
+++ loncom/loncron	Thu Oct 25 03:27:22 2018
@@ -2,7 +2,7 @@
 
 # Housekeeping program, started by cron, loncontrol and loncron.pl
 #
-# $Id: loncron,v 1.109 2018/10/25 02:48:56 raeburn Exp $
+# $Id: loncron,v 1.110 2018/10/25 03:27:22 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -113,17 +113,20 @@
     my $result;
     &log($fh,'<hr /><a name="'.$daemon.'" /><h2>'.$daemon.'</h2><h3>Log</h3><p style="white-space: pre;"><tt>');
     printf("%-15s ",$daemon);
-    if (-e "$perlvar{'lonDaemons'}/logs/$daemon.log"){
-	open (DFH,"tail -n25 $perlvar{'lonDaemons'}/logs/$daemon.log|");
-	while (my $line=<DFH>) { 
-	    &log($fh,"$line");
-	    if ($line=~/INFO/) { $notices++; }
-	    if ($line=~/WARNING/) { $notices++; }
-	    if ($line=~/CRITICAL/) { $warnings++; }
-	};
-	close (DFH);
+    if ($fh) {
+        if (-e "$perlvar{'lonDaemons'}/logs/$daemon.log"){
+	    if (open(DFH,"tail -n25 $perlvar{'lonDaemons'}/logs/$daemon.log|")) {
+	        while (my $line=<DFH>) { 
+	            &log($fh,"$line");
+	            if ($line=~/INFO/) { $notices++; }
+	            if ($line=~/WARNING/) { $notices++; }
+	            if ($line=~/CRITICAL/) { $warnings++; }
+	        }
+	        close (DFH);
+            }
+        }
+        &log($fh,"</tt></p>");
     }
-    &log($fh,"</tt></p>");
     
     my $pidfile="$perlvar{'lonDaemons'}/logs/$daemon.pid";
     
@@ -169,7 +172,7 @@
             &clean_lonc_childpids();
         }
 	&log($fh,"<h3>$daemon not running, trying to start</h3>");
-	
+
 	if (&start_daemon($fh,$daemon,$pidfile,$args)) {
 	    &log($fh,"<h3>$daemon at pid $daemonpid responding</h3>");
 	    $simplestatus{$daemon}='restarted';
@@ -194,17 +197,19 @@
 		&log($fh,"<p>Unable to start $daemon</p>");
 	    }
 	}
-
-	if (-e "$perlvar{'lonDaemons'}/logs/$daemon.log"){
-	    &log($fh,"<p><pre>");
-	    open (DFH,"tail -n100 $perlvar{'lonDaemons'}/logs/$daemon.log|");
-	    while (my $line=<DFH>) { 
-		&log($fh,"$line");
-		if ($line=~/WARNING/) { $notices++; }
-		if ($line=~/CRITICAL/) { $notices++; }
-	    };
-	    close (DFH);
-	    &log($fh,"</pre></p>");
+        if ($fh) {
+	    if (-e "$perlvar{'lonDaemons'}/logs/$daemon.log"){
+	        &log($fh,"<p><pre>");
+	        if (open(DFH,"tail -n100 $perlvar{'lonDaemons'}/logs/$daemon.log|")) {
+	            while (my $line=<DFH>) { 
+		        &log($fh,"$line");
+		        if ($line=~/WARNING/) { $notices++; }
+		        if ($line=~/CRITICAL/) { $notices++; }
+	            }
+	            close (DFH);
+                }
+	        &log($fh,"</pre></p>");
+            }
 	}
     }
     




More information about the LON-CAPA-cvs mailing list