fix a few memory leaks and cppcheck detected errors - more in bugreport
[client-tools.git] / exe / linux / exec_command.pl
blobf97254afd92bf2be9dd91fe4f0fb03a0119684fc
1 #!/usr/bin/perl
3 use Getopt::Std;
4 require "/m1/homes/swgsrv/nodes.pl";
6 # verify cmd line arguments and abort if incorrect
7 $Getopt::Std::opt_v = "";
8 Getopt::Std::getopts("v");
10 if ( ! $ARGV[0] )
12 print "usage: startcluster.pl <CLUSTER>\n";
13 print " e.g: startcluster.pl dev\n";
14 exit;
17 $cmd = $ARGV[1];
18 $cluster = $ARGV[0];
19 if ( ! $node{"$cluster"}{"01"} )
21 print "cluster: $cluster not defined\n";
22 exit;
24 else
26 foreach $n ( sort { $a <=> $b } keys % {$node{"$cluster"}} )
28 $hostname = "$node{\"$cluster\"}{\"$n\"}.$domain";
29 system("/usr/local/bin/ssh -f $user\@$hostname \"$cmd \"");