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

git-svn-id: https://svn.apache.org/repos/asf/incubator/cassandra/trunk@823637 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Eric Evans 2009-10-09 17:49:59 +00:00
parent 4a4b8bebf7
commit 93a88e61c8
1 changed files with 9 additions and 4 deletions

View File

@ -102,6 +102,7 @@ launch_service()
{
pidpath=$1
foreground=$2
props=$3
cassandra_parms="-Dcassandra -Dstorage-config=$CASSANDRA_CONF"
if [ "x$pidpath" != "x" ]; then
@ -112,11 +113,11 @@ launch_service()
# 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 @@ launch_service()
}
# Parse any command line options.
args=`getopt fhp:b "$@"`
args=`getopt fhp:bD: "$@"`
eval set -- "$args"
while true; do
@ -142,6 +143,10 @@ while true; do
echo "Usage: $0 [-f] [-h] [-p pidfile] [-b]"
exit 0
;;
-D)
properties="$properties -D$2"
shift 2
;;
--)
shift
break
@ -154,7 +159,7 @@ while true; do
done
# Start up the service
launch_service "$pidfile" "$foreground"
launch_service "$pidfile" "$foreground" "$properties"
exit $?