From 3ec5c6291ffea9c4e0f8598173241de7e2924bc1 Mon Sep 17 00:00:00 2001 From: hadaq Date: Fri, 3 Apr 2009 13:14:24 +0000 Subject: [PATCH] Added arg option for arguments of a script to be restarted. Sergey. --- plugins/restart.pl | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/plugins/restart.pl b/plugins/restart.pl index 80b2508..b792709 100755 --- a/plugins/restart.pl +++ b/plugins/restart.pl @@ -11,8 +11,8 @@ use warnings; use Getopt::Std; use File::Basename; -our ($opt_s, $opt_r, $opt_k, $opt_h); -getopts('hs:p:kr'); +our ($opt_s, $opt_r, $opt_k, $opt_a, $opt_h); +getopts('hs:a:kr'); if($opt_h){ &showHelp(); @@ -24,7 +24,7 @@ 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 = "-d"; #- arguments of script to be restarted +my $args = $opt_a; #- arguments of script to be restarted &main(); @@ -70,7 +70,7 @@ sub main sub checkArgs { if( !defined($opt_s) ){ - print "You must provide -s option with arguments!\n"; + print "You must provide -s option with an argument!\n"; print "Read help: restart.pl -h\n"; exit(0); } @@ -86,10 +86,10 @@ sub printMessage print "kill $prog_name on $PC ...\n"; } elsif($opt_r){ - print "restart $prog_name on $PC ...\n"; + print "restart $prog_name $args on $PC ...\n"; } else{ - print "start $prog_name on $PC ...\n"; + print "start $prog_name $args on $PC ...\n"; } } @@ -105,10 +105,11 @@ 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 [-k] [-h] + Usage: restart.pl -s [-a] [-k] [-h] -s : Name of script to be restarted. Name must contain a path to a script on remote PC! + -a : 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. -- 2.43.0