[LON-CAPA-cvs] cvs: loncom(version_2_11_X) / loncron

raeburn raeburn at source.lon-capa.org
Sat Feb 9 22:02:10 EST 2019


raeburn		Sun Feb 10 03:02:10 2019 EDT

  Modified files:              (Branch: version_2_11_X)
    /loncom	loncron 
  Log:
  - For 2.11
    Backport 1.110, 1.111, 1.112. 
  
  
Index: loncom/loncron
diff -u loncom/loncron:1.103.2.1 loncom/loncron:1.103.2.2
--- loncom/loncron:1.103.2.1	Fri Oct 20 13:38:34 2017
+++ loncom/loncron	Sun Feb 10 03:02:10 2019
@@ -2,7 +2,7 @@
 
 # Housekeeping program, started by cron, loncontrol and loncron.pl
 #
-# $Id: loncron,v 1.103.2.1 2017/10/20 13:38:34 raeburn Exp $
+# $Id: loncron,v 1.103.2.2 2019/02/10 03:02:10 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -111,18 +111,21 @@
     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";
     
     my $restartflag=1;
@@ -164,7 +167,7 @@
 	    `killall -9 $kadaemon 2>&1`.
 	    '</font><br />');
 	&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';
@@ -189,18 +192,20 @@
 		&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>");
+	    }
+        }
     }
     
     my $fname="$perlvar{'lonDaemons'}/logs/$daemon.log";
@@ -908,8 +913,8 @@
 	chop $hostname;
 	$hostname=~s/[^\w\.]//g; # make sure is safe to pass through shell
 	my $subj="LON: Unconfigured machine $hostname";
-	system("echo 'Unconfigured machine $hostname.' |\
- mailto $emailto -s '$subj' > /dev/null");
+	system("echo 'Unconfigured machine $hostname.' |".
+               " mail -s '$subj' $emailto > /dev/null");
 	exit 1;
     }
 
@@ -919,8 +924,8 @@
 	print("User ID mismatch. This program must be run as user 'www'.\n");
 	my $emailto="$perlvar{'lonAdmEMail'},$perlvar{'lonSysEMail'}";
 	my $subj="LON: $perlvar{'lonHostID'} User ID mismatch";
-	system("echo 'User ID mismatch. loncron must be run as user www.' |\
- mailto $emailto -s '$subj' > /dev/null");
+	system("echo 'User ID mismatch. loncron must be run as user www.' |".
+               " mail -s '$subj' $emailto > /dev/null");
 	exit 1;
     }
 




More information about the LON-CAPA-cvs mailing list