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

foxr lon-capa-cvs@mail.lon-capa.org
Mon, 03 Nov 2003 10:18:13 -0000


foxr		Mon Nov  3 05:18:13 2003 EDT

  Modified files:              
    /loncom	lonManage 
  Log:
  Add/debug code to support reading alternat hosts.tab for use in standalone environment.
  
  
Index: loncom/lonManage
diff -u loncom/lonManage:1.18 loncom/lonManage:1.19
--- loncom/lonManage:1.18	Tue Oct 28 06:55:58 2003
+++ loncom/lonManage	Mon Nov  3 05:18:13 2003
@@ -3,9 +3,9 @@
 #
 #  lonManage supports remote management of nodes in a LonCAPA cluster.
 #
-#  $Id: lonManage,v 1.18 2003/10/28 11:55:58 foxr Exp $
+#  $Id: lonManage,v 1.19 2003/11/03 10:18:13 foxr Exp $
 #
-# $Id: lonManage,v 1.18 2003/10/28 11:55:58 foxr Exp $
+# $Id: lonManage,v 1.19 2003/11/03 10:18:13 foxr Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -71,8 +71,8 @@
 my %perlvar;			# Perl variable defs from apache config.
 my %hostshash;			# Host table as a host indexed hash.
 
-my $MyHost;			# Host name to use as me.
-my $ForeignHostTab;		# Name of foreign hosts table.
+my $MyHost="";			# Host name to use as me.
+my $ForeignHostTab="";		# Name of foreign hosts table.
 
 #
 #   prints out utility's command usage info.
@@ -227,14 +227,26 @@
     return @result;
 }
 #
-#  Read the loncapa configuration stuff.
+#  Read the loncapa configuration stuff.  If ForeignHostTab is empty,
+#  assume we are part of a loncapa cluster and read the hosts.tab
+#  file from the config directory.  Otherwise, ForeignHossTab
+#  is the name of an alternate configuration file to read in 
+#  standalone mode.
 #
 sub ReadConfig {
-    my $perlvarref = LondConnection::read_conf('loncapa.conf');
-    %perlvar       = %{$perlvarref};
-    my $hoststab   = LondConnection::read_hosts(
-					"$perlvar{'lonTabDir'}/hosts.tab");
-    %hostshash     = %{$hoststab};
+
+    if($ForeignHostTab eq "") {
+	my $perlvarref = LondConnection::read_conf('loncapa.conf');
+	%perlvar       = %{$perlvarref};
+	my $hoststab   = LondConnection::read_hosts(
+					    "$perlvar{'lonTabDir'}/hosts.tab");
+	%hostshash     = %{$hoststab};
+    } else {
+	my $hoststab   = LondConnection::read_hosts($ForeignHostTab);
+	%hostshash     = %{$hoststab};
+	$perlvar{londPort}   = 5663;
+	$perlvar{lonSockDir} = "/home/httpd/sockets";
+    }
 
 }
 #
@@ -388,7 +400,6 @@
 }
 #--------------------------- Entry point: --------------------------
 
-ReadConfig;			# Read the configuration info (incl.hosts).
 
 
 #  Parse the parameters
@@ -408,6 +419,11 @@
     die "ENOPRIV - No privilege for requested operation"
 }
 
+#
+#   Read the configuration file.
+#   
+
+ReadConfig;			# Read the configuration info (incl.hosts).
 
 #   Based on the operation requested invoke the appropriate function: