]> jspc29.x-matter.uni-frankfurt.de Git - hadesicinga.git/commitdiff
Added -m <pcname> option to start script on a given machine. Sergey.
authorhadaq <hadaq>
Fri, 3 Apr 2009 13:53:38 +0000 (13:53 +0000)
committerhadaq <hadaq>
Fri, 3 Apr 2009 13:53:38 +0000 (13:53 +0000)
plugins/restart.pl

index b792709590959ed332220fa89b147ff69be8d945..295e164e6656035e766feecd2243944248a92f1e 100755 (executable)
@@ -11,8 +11,8 @@ use warnings;
 use Getopt::Std;
 use File::Basename;
 
-our ($opt_s, $opt_r, $opt_k, $opt_a, $opt_h);
-getopts('hs:a:kr');
+our ($opt_s, $opt_r, $opt_k, $opt_a, $opt_h, $opt_m);
+getopts('hs:a:krm:');
 
 if($opt_h){
     &showHelp();
@@ -23,9 +23,10 @@ if($opt_h){
 
 #--- on these PCs the script should be restarted:
 my @PCList = ('lxg0429','lxg0433','lxg0435','lxg0437','lxg0439','lxg0440','lxg0441','lxg0442','lxg0443','lxg0444','lxg0445','lxg0446','lxg0447','lxg0448','lxg0452','lxg0453','lxg0454','lxg0455');
-#my @PCList = ('lxg0429');
 my $args = $opt_a;    #- arguments of script to be restarted
 
+&editPCList();
+
 &main();
 
 exit(0);
@@ -76,6 +77,13 @@ sub checkArgs
     }
 }
 
+sub editPCList
+{
+    if( defined($opt_m) ){
+       @PCList = ($opt_m);
+    }
+}
+
 sub printMessage
 {
     my $PC = shift;
@@ -105,14 +113,15 @@ sub showHelp
       to remote PCs, thus, you must set up private/public keys!
       The remote script will be restarted under your 'user name'. 
 
-    Usage: restart.pl -s <name> [-a] [-k] [-h]
+    Usage: restart.pl -s <name> [-a] [-k] [-m <pcname>] [-h]
 
-      -s <name> : Name of script to be restarted. Name must 
-                  contain a path to a script on remote PC!
-      -a <args> : Arguments for a script to be (re)started.
-      -r        : Kill a running script before restarting.
-      -k        : Kill a running script without restarting.
-      -h        : Print this help.
+      -s <name>   : Name of script to be (re)started. Name must 
+                    contain a path to a script on remote PC!
+      -a <args>   : Arguments for a script to be (re)started.
+      -r          : Kill a running script before restarting.
+      -k          : Kill a running script without restarting.
+      -m <pcname> : Restart script on "pcname" only.
+      -h          : Print this help.
 
       If there is only -s <name> specified this script will 
       remotely start <name> program without trying to kill