diff options
| author | graehl <graehl@ec762483-ff6d-05da-a07a-a48fb63a330f> | 2010-06-28 01:18:00 +0000 | 
|---|---|---|
| committer | graehl <graehl@ec762483-ff6d-05da-a07a-a48fb63a330f> | 2010-06-28 01:18:00 +0000 | 
| commit | 3e292f48ae09fef3ba31bd2e5082997b15385fcc (patch) | |
| tree | 54178002545db1df7f5c2511ff8ef8fbcc4845f4 /vest | |
| parent | 10ab57055dadcc0974602dad4634618c7791dbb2 (diff) | |
run netstat once only, and w/ windows compat options
git-svn-id: https://ws10smt.googlecode.com/svn/trunk@34 ec762483-ff6d-05da-a07a-a48fb63a330f
Diffstat (limited to 'vest')
| -rwxr-xr-x | vest/parallelize.pl | 17 | 
1 files changed, 11 insertions, 6 deletions
| diff --git a/vest/parallelize.pl b/vest/parallelize.pl index 7a4a2133..45152144 100755 --- a/vest/parallelize.pl +++ b/vest/parallelize.pl @@ -29,6 +29,9 @@ my $verbose = 1;  my $numnodes;  my $user = $ENV{"USER"};  my $pmem = "2g"; +my $basep=50300; +my $randp=300; +my $tryp=50;  sub print_help; @@ -41,7 +44,9 @@ if (GetOptions(  			"file=s" => \@files_to_stage,  			"verbose" => \$verbose,  			"jobs=i" => \$numnodes, -			"pmem=s" => \$pmem +			"pmem=s" => \$pmem, +        "baseport=i" => \$basep, +        "iport=i" => \$randp, #ugly option name so first letter doesn't conflict  ) == 0 || @ARGV == 0){  	print_help();  } @@ -89,13 +94,14 @@ $executable=`basename $executable`;  chomp $executable;  # find open port -my $basep=50300; -my $randp=300; -my $tryp=50; +srand;  my $port = 50300+int(rand($randp));  my $endp=$port+$tryp; +my $netstat=`netstat -a -n 2>/dev/null | grep LISTENING | grep -i tcp`; +  if ($verbose){ print STDERR "Testing port $port...";} -while (`netstat -ln 2>/dev/null | grep $port`){ + +while ($netstat=~/$port/s){  	if ($verbose){ print STDERR "port is busy\n";}  	$port++;  	if ($port > $endp){ @@ -107,7 +113,6 @@ if ($verbose){  	print STDERR "port $port is available\n";  } -srand;  my $key = int(rand()*1000000);  my $multiflag = ""; | 
