Add -a option to skip TIME_WAIT port check on Windows startup

Patch by jmckenzie; reviewed by pthompson for CASSANDRA-10524


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/78753263
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/78753263
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/78753263

Branch: refs/heads/cassandra-3.0
Commit: 78753263e52ada59f8836e83f00c0613488df87e
Parents: 25366f7
Author: Joshua McKenzie <jmcken...@apache.org>
Authored: Wed Oct 14 14:43:32 2015 -0400
Committer: Joshua McKenzie <jmcken...@apache.org>
Committed: Wed Oct 14 14:43:32 2015 -0400

----------------------------------------------------------------------
 bin/cassandra.ps1 | 8 ++++++++
 1 file changed, 8 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/78753263/bin/cassandra.ps1
----------------------------------------------------------------------
diff --git a/bin/cassandra.ps1 b/bin/cassandra.ps1
index 5cc99aa..8cdd433 100644
--- a/bin/cassandra.ps1
+++ b/bin/cassandra.ps1
@@ -27,6 +27,7 @@ usage: cassandra.ps1 [-f] [-h] [-p pidfile] [-H dumpfile] [-D 
arg] [-E errorfile
     -E              change JVM ErrorFile
     -v              Print cassandra version and exit
     -s              Show detailed jvm environment information during launch
+    -a              Aggressive startup. Ignore ports that are TIME_WAIT for 
VerifyPorts check.
     -help           print this message
 
     NOTE: installing cassandra as a service requires Commons Daemon Service 
Runner
@@ -307,6 +308,10 @@ Function VerifyPortsAreAvailable
     {
         if ($line -match "TCP" -and $line -match $portRegex)
         {
+            if ($a -and $line -match "TIME_WAIT")
+            {
+               continue
+            }
             Write-Error "Found a port already in use. Aborting startup"
             Write-Error $line
             Exit
@@ -352,12 +357,15 @@ for ($i = 0; $i -lt $args.count; $i++)
         "-install"          { $install = $True }
         "-uninstall"        { $uninstall = $True }
         "-help"             { PrintUsage }
+        "-?"                { PrintUsage }
+        "--help"            { PrintUsage }
         "-v"                { $v = $True }
         "-f"                { $f = $True }
         "-s"                { $s = $True }
         "-p"                { $p = $args[++$i]; CheckEmptyParam($p) }
         "-H"                { $H = $args[++$i]; CheckEmptyParam($H) }
         "-E"                { $E = $args[++$i]; CheckEmptyParam($E) }
+        "-a"                { $a = $True }
         default
         {
             "Invalid argument: " + $args[$i];

Reply via email to