Repository: cassandra
Updated Branches:
  refs/heads/cassandra-2.1 57ec7b735 -> 22f811e3b
  refs/heads/trunk ca60eacad -> 41a91e9a1


add support for arbitrary -D options to .ps1 script
patch by Joshua McKenzie; reviewed by Philip Thompson for CASSANDRA-7435


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

Branch: refs/heads/cassandra-2.1
Commit: 22f811e3b56e2d968d4724fcf99d11b4e0a7d037
Parents: 57ec7b7
Author: Jonathan Ellis <jbel...@apache.org>
Authored: Thu Jul 17 12:04:53 2014 -0500
Committer: Jonathan Ellis <jbel...@apache.org>
Committed: Thu Jul 17 12:05:00 2014 -0500

----------------------------------------------------------------------
 bin/cassandra.ps1 | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/22f811e3/bin/cassandra.ps1
----------------------------------------------------------------------
diff --git a/bin/cassandra.ps1 b/bin/cassandra.ps1
index 53b0032..4417c0c 100644
--- a/bin/cassandra.ps1
+++ b/bin/cassandra.ps1
@@ -43,12 +43,13 @@ Function ValidateArguments
 Function PrintUsage
 {
     echo @"
-usage: cassandra.ps1 [-f] [-h] [-p pidfile] [-H dumpfile] [-E errorfile] 
[-install | -uninstall] [-help]
+usage: cassandra.ps1 [-f] [-h] [-p pidfile] [-H dumpfile] [-D arg] [-E 
errorfile] [-install | -uninstall] [-help]
     -f              Run cassandra in foreground
     -install        install cassandra as a service
     -uninstall      remove cassandra service
     -p              pidfile tracked by server and removed on close (defaults 
to pid.txt)
     -H              change JVM HeapDumpPath
+    -D              items to append to JVM_OPTS
     -E              change JVM ErrorFile
     -help           print this message
     -verbose        Show detailed command-line parameters for cassandra run
@@ -103,6 +104,16 @@ Function Main
         $env:CASSANDRA_PARAMS = $env:CASSANDRA_PARAMS + ' 
-Dcassandra-pidfile="' + "$pidfile" + '"'
     }
 
+    # Parse -D JVM_OPTS
+    for ($i = 0; $i -lt $script:args.Length; ++$i)
+    {
+        if ($script:args[$i].Substring(0,2) -eq "-D")
+        {
+            $param = $script:args[$i].Substring(2)
+            $env:JVM_OPTS = "$env:JVM_OPTS -D$param"
+        }
+    }
+
     if ($install -or $uninstall)
     {
         HandleInstallation
@@ -191,8 +202,8 @@ Function RunCassandra([string]$foreground)
     $cmd = @"
 $env:JAVA_BIN
 "@
-    $arg1 = $env:JVM_OPTS
-    $arg2 = $env:CASSANDRA_PARAMS
+    $arg1 = $env:CASSANDRA_PARAMS
+    $arg2 = $env:JVM_OPTS
     $arg3 = "-cp $env:CLASSPATH"
     $arg4 = @"
 "$env:CASSANDRA_MAIN"

Reply via email to