[LON-CAPA-cvs] cvs: loncom / LONCAPA.pm loncron

raeburn raeburn at source.lon-capa.org
Fri Feb 8 09:49:51 EST 2013


raeburn		Fri Feb  8 14:49:51 2013 EDT

  Modified files:              
    /loncom	LONCAPA.pm loncron 
  Log:
  - Move routine used to get Linux distro from &get_distro() in loncron
    to &distro() in LONCAPA.pm to facilitate reuse.
  
  
Index: loncom/LONCAPA.pm
diff -u loncom/LONCAPA.pm:1.33 loncom/LONCAPA.pm:1.34
--- loncom/LONCAPA.pm:1.33	Mon Nov  7 20:05:52 2011
+++ loncom/LONCAPA.pm	Fri Feb  8 14:49:51 2013
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Base routines
 #
-# $Id: LONCAPA.pm,v 1.33 2011/11/07 20:05:52 www Exp $
+# $Id: LONCAPA.pm,v 1.34 2013/02/08 14:49:51 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -138,6 +138,16 @@
     return $result;
 }
 
+# Return the Linux distro where this LON-CAPA instance is running
+
+sub distro {
+    my $distro;
+    if (open(PIPE,"/home/httpd/perl/distprobe |")) {
+        $distro = <PIPE>;
+        close(PIPE);
+    }
+    return $distro;
+}
 
 #----------------------------------------------------------------------
 #
Index: loncom/loncron
diff -u loncom/loncron:1.97 loncom/loncron:1.98
--- loncom/loncron:1.97	Sat Feb  2 14:42:01 2013
+++ loncom/loncron	Fri Feb  8 14:49:51 2013
@@ -2,7 +2,7 @@
 
 # Housekeeping program, started by cron, loncontrol and loncron.pl
 #
-# $Id: loncron,v 1.97 2013/02/02 14:42:01 raeburn Exp $
+# $Id: loncron,v 1.98 2013/02/08 14:49:51 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -271,7 +271,7 @@
 
     &log($fh,"<h3>distprobe</h3>");
     &log($fh,"<pre>");
-    &get_distro($perlvar{'lonDaemons'},$fh);
+    &log($fh,&encode_entities(&LONCAPA::distro(),'<>&"'));
     &log($fh,"</pre>");
 
     &errout($fh);
@@ -752,7 +752,7 @@
 }
 
 sub write_checksums {
-    my $distro = &get_distro($perlvar{'lonDaemons'});
+    my $distro = &LONCAPA::distro();
     if ($distro) {
         print "Retrieving file version and checksumming.\n";
         my $numchksums = 0;
@@ -788,21 +788,6 @@
     }
 }
 
-sub get_distro {
-    my ($dir,$fh) = @_;
-    my $distro;
-    if (open(my $disth,"$dir/distprobe |")) {
-        while (my $line=<$disth>) {
-            if ($fh) {
-                &log($fh,&encode_entities($line,'<>&"'));
-            }
-            $distro .= $line;
-        }
-        close($disth);
-    }
-    return $distro;
-}
-
 sub usage {
     print(<<USAGE);
 loncron - housekeeping program that checks up on various parts of Lon-CAPA




More information about the LON-CAPA-cvs mailing list