--- loncom/Attic/lonManage 2003/08/12 10:55:42 1.5 +++ loncom/Attic/lonManage 2003/08/12 11:02:59 1.6 @@ -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 @@ sub ParseArgs { # --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 @@ sub ParseArgs { # --reinit takes in addition just a host name if($paramcount != 1) { - print "Bad count $paramcount\n"; return (); } if($command ne '') { @@ -171,22 +172,44 @@ sub ParseArgs { 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