You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by ee...@apache.org on 2009/10/09 19:49:59 UTC

svn commit: r823637 - /incubator/cassandra/trunk/bin/cassandra

Author: eevans
Date: Fri Oct  9 17:49:59 2009
New Revision: 823637

URL: http://svn.apache.org/viewvc?rev=823637&view=rev
Log:
pass -D arguments to the jvm from startup script

Let getopt parse -D options passed to the script, reconstruct them, and
pass them on to the vm.

Patch by eevans; review by jbellis for CASSANDRA-374

Modified:
    incubator/cassandra/trunk/bin/cassandra

Modified: incubator/cassandra/trunk/bin/cassandra
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/bin/cassandra?rev=823637&r1=823636&r2=823637&view=diff
==============================================================================
--- incubator/cassandra/trunk/bin/cassandra (original)
+++ incubator/cassandra/trunk/bin/cassandra Fri Oct  9 17:49:59 2009
@@ -102,6 +102,7 @@
 {
     pidpath=$1
     foreground=$2
+    props=$3
     cassandra_parms="-Dcassandra -Dstorage-config=$CASSANDRA_CONF"
 
     if [ "x$pidpath" != "x" ]; then
@@ -112,11 +113,11 @@
     # to close stdout/stderr, but it's up to us not to background.
     if [ "x$foreground" != "x" ]; then
         cassandra_parms="$cassandra_parms -Dcassandra-foreground=yes"
-        $JAVA $JVM_OPTS $cassandra_parms -cp $CLASSPATH \
+        $JAVA $JVM_OPTS $cassandra_parms -cp $CLASSPATH $props \
                 org.apache.cassandra.service.CassandraDaemon
     # Startup CassandraDaemon, background it, and write the pid.
     else
-        exec $JAVA $JVM_OPTS $cassandra_parms -cp $CLASSPATH \
+        exec $JAVA $JVM_OPTS $cassandra_parms -cp $CLASSPATH $props \
                     org.apache.cassandra.service.CassandraDaemon <&- &
         [ ! -z $pidpath ] && printf "%d" $! > $pidpath
     fi
@@ -125,7 +126,7 @@
 }
 
 # Parse any command line options.
-args=`getopt fhp:b "$@"`
+args=`getopt fhp:bD: "$@"`
 eval set -- "$args"
 
 while true; do
@@ -142,6 +143,10 @@
             echo "Usage: $0 [-f] [-h] [-p pidfile] [-b]"
             exit 0
         ;;
+        -D)
+            properties="$properties -D$2"
+            shift 2
+        ;;
         --)
             shift
             break
@@ -154,7 +159,7 @@
 done
 
 # Start up the service
-launch_service "$pidfile" "$foreground"
+launch_service "$pidfile" "$foreground" "$properties"
 
 exit $?