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

foxr lon-capa-cvs@mail.lon-capa.org
Tue, 12 Aug 2003 11:02:59 -0000


foxr		Tue Aug 12 07:02:59 2003 EDT

  Modified files:              
    /loncom	lonManage 
  Log:
  Implement command switch dispatching.
  
  
  
Index: loncom/lonManage
diff -u loncom/lonManage:1.5 loncom/lonManage:1.6
--- loncom/lonManage:1.5	Tue Aug 12 06:55:42 2003
+++ loncom/lonManage	Tue Aug 12 07:02:59 2003
@@ -3,9 +3,9 @@
 #
 #  lonManage supports remote management of nodes in a LonCAPA cluster.
 #
-#  $Id: lonManage,v 1.5 2003/08/12 10:55:42 foxr Exp $
+#  $Id: lonManage,v 1.6 2003/08/12 11:02:59 foxr Exp $
 #
-# $Id: lonManage,v 1.5 2003/08/12 10:55:42 foxr Exp $
+# $Id: lonManage,v 1.6 2003/08/12 11:02:59 foxr Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -50,6 +50,9 @@
 #    not the IP address of the host.
 #
 #  $Log: lonManage,v $
+#  Revision 1.6  2003/08/12 11:02:59  foxr
+#  Implement command switch dispatching.
+#
 #  Revision 1.5  2003/08/12 10:55:42  foxr
 #  Complete command line parsing (tested)
 #
@@ -132,7 +135,6 @@
         # --push takes in addition a table, and a host:
         #
 	if($paramcount != 2) {
-	    print "Bad count $paramcount\n";
 	    return ();		# Invalid parameter count.
 	}
 	if($command ne '') {
@@ -149,7 +151,6 @@
 	# --reinit takes in addition just a host name
 
 	if($paramcount != 1) {
-	    print "Bad count $paramcount\n";
 	    return ();
 	}
 	if($command ne '') {
@@ -171,22 +172,44 @@
     return @result;
 }
 
-#
-#    If command parsing failed, then print usage:
+#--------------------------- Entry point: --------------------------
+
+#  Parse the parameters
+#  If command parsing failed, then print usage:
 
-@status = ParseArgs;
-$nparam   = @status;
+@params = ParseArgs;
+$nparam   = @params;
 
 if($nparam == 0) {
     Usage;
     exit -1;
 }
 
-print "---- params ---\n";
-for($i = 0; $i < $nparam; $i++) {
-    print "Param[$i] = $status[$i]\n";
+
+sub PushFile {
+    print "Pushing a file\n";
+}
+
+sub ReinitProcess {
+    print "Reinitializing a process\n";
 }
 
+#   Based on the operation requested invoke the appropriate function:
+
+$operation = shift @params;
+
+if($operation eq "push") {  # push tablename filename host
+    $tablename = shift @params;
+    $tablefile = shift @params;
+    $host      = shift @params;
+    PushFile($tablename, $tablefile, $host);
+
+}
+if($operation eq "reinit") {	# reinit processname host.
+    $process   = shift @params;
+    $host      = shift @params;
+    ReinitProcess($process, $host);
+}
 exit 0;
 
 =head1 NAME