]> jspc29.x-matter.uni-frankfurt.de Git - hadesicinga.git/commitdiff
Not important. Sergey.
authorhadaq <hadaq>
Thu, 29 Jan 2009 13:24:24 +0000 (13:24 +0000)
committerhadaq <hadaq>
Thu, 29 Jan 2009 13:24:24 +0000 (13:24 +0000)
plugins/restart.pl

index 1465dd96373527cf0b49c977cf340aa5c9f2cfd9..1492de82eb5c3fe7fb3443cbfe7769d7939dedeb 100755 (executable)
@@ -9,6 +9,7 @@
 use strict;
 use warnings;
 use Getopt::Std;
+use File::Basename;
 
 our ($opt_s, $opt_r, $opt_k, $opt_h);
 getopts('hs:p:kr');
@@ -21,9 +22,9 @@ if($opt_h){
 &checkArgs();
 
 #--- 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 = ('lxg0447');
-my $args   = "-d";       #- arguments of script to be restarted
+my @PCList = ('lxg0429','lxg0433','lxg0435','lxg0437','lxg0439','lxg0440','lxg0441','lxg0442','lxg0443','lxg0444','lxg0445','lxg0446','lxg0447','lxg0448','lxg0452','lxg0453','lxg0454','lxg0455');
+#my @PCList = ('lxg0447');
+my $args = "-d";    #- arguments of script to be restarted
 
 &main();
 
@@ -34,13 +35,9 @@ exit(0);
 sub main
 {
     
-    #--- 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 = ('lxg0447');
-
     foreach my $PC (@PCList) {
 
-       print "restart on $PC ...\n";
+       &printMessage($PC);
 
        if( $opt_k || $opt_r ){
            #--- get PIDs of running scripts
@@ -79,6 +76,23 @@ sub checkArgs
     }
 }
 
+sub printMessage
+{
+    my $PC = shift;
+
+    my $prog_name = basename($opt_s);
+
+    if($opt_k){
+       print "kill $prog_name on $PC ...\n";
+    }
+    elsif($opt_r){
+       print "restart $prog_name on $PC ...\n";
+    }
+    else{
+       print "start $prog_name on $PC ...\n";
+    }
+}
+
 sub showHelp
 {
     print << 'EOF';
@@ -99,5 +113,9 @@ sub showHelp
       -k        : Kill a running script without restarting.
       -h        : Print this help.
 
+      If there is only -s <name> specified this script will 
+      remotely start <name> program without trying to kill 
+      it first.
+
 EOF
 }