Startup script: fix shell quoting.
Paths should be quoted to avoid problems with spaces. Arguments to the `case' command do not need to be quoted as it doesn't undergo word splitting.
This commit is contained in:
parent
0319972d77
commit
50a475fd02
|
@ -66,10 +66,10 @@ done
|
||||||
ES_HOME=`dirname "$SCRIPT"`/..
|
ES_HOME=`dirname "$SCRIPT"`/..
|
||||||
|
|
||||||
# make ELASTICSEARCH_HOME absolute
|
# make ELASTICSEARCH_HOME absolute
|
||||||
ES_HOME=`cd $ES_HOME; pwd`
|
ES_HOME=`cd "$ES_HOME"; pwd`
|
||||||
|
|
||||||
|
|
||||||
if [ -x $JAVA_HOME/bin/java ]; then
|
if [ -x "$JAVA_HOME/bin/java" ]; then
|
||||||
JAVA=$JAVA_HOME/bin/java
|
JAVA=$JAVA_HOME/bin/java
|
||||||
else
|
else
|
||||||
JAVA=`which java`
|
JAVA=`which java`
|
||||||
|
@ -82,24 +82,24 @@ if [ "x$ES_INCLUDE" = "x" ]; then
|
||||||
/usr/local/share/elasticsearch/elasticsearch.in.sh \
|
/usr/local/share/elasticsearch/elasticsearch.in.sh \
|
||||||
/opt/elasticsearch/elasticsearch.in.sh \
|
/opt/elasticsearch/elasticsearch.in.sh \
|
||||||
~/.elasticsearch.in.sh \
|
~/.elasticsearch.in.sh \
|
||||||
`dirname $0`/elasticsearch.in.sh; do
|
`dirname "$0"`/elasticsearch.in.sh; do
|
||||||
if [ -r $include ]; then
|
if [ -r "$include" ]; then
|
||||||
. $include
|
. "$include"
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
# ...otherwise, source the specified include.
|
# ...otherwise, source the specified include.
|
||||||
elif [ -r $ES_INCLUDE ]; then
|
elif [ -r "$ES_INCLUDE" ]; then
|
||||||
. $ES_INCLUDE
|
. "$ES_INCLUDE"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z $ES_CLASSPATH ]; then
|
if [ -z "$ES_CLASSPATH" ]; then
|
||||||
echo "You must set the ES_CLASSPATH var" >&2
|
echo "You must set the ES_CLASSPATH var" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Special-case path variables.
|
# Special-case path variables.
|
||||||
case "`uname`" in
|
case `uname` in
|
||||||
CYGWIN*)
|
CYGWIN*)
|
||||||
ES_CLASSPATH=`cygpath -p -w "$ES_CLASSPATH"`
|
ES_CLASSPATH=`cygpath -p -w "$ES_CLASSPATH"`
|
||||||
;;
|
;;
|
||||||
|
@ -126,7 +126,7 @@ launch_service()
|
||||||
# Startup ElasticSearch, background it, and write the pid.
|
# Startup ElasticSearch, background it, and write the pid.
|
||||||
exec $JAVA $JAVA_OPTS $ES_JAVA_OPTS $es_parms -cp $ES_CLASSPATH $props \
|
exec $JAVA $JAVA_OPTS $ES_JAVA_OPTS $es_parms -cp $ES_CLASSPATH $props \
|
||||||
org.elasticsearch.bootstrap.ElasticSearch <&- &
|
org.elasticsearch.bootstrap.ElasticSearch <&- &
|
||||||
[ ! -z $pidpath ] && printf "%d" $! > $pidpath
|
[ ! -z "$pidpath" ] && printf '%d' $! > "$pidpath"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
return $?
|
return $?
|
||||||
|
@ -137,7 +137,7 @@ args=`getopt vfhp:D:X: "$@"`
|
||||||
eval set -- "$args"
|
eval set -- "$args"
|
||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
case "$1" in
|
case $1 in
|
||||||
-v)
|
-v)
|
||||||
$JAVA $JAVA_OPTS $ES_JAVA_OPTS $es_parms -cp $ES_CLASSPATH $props \
|
$JAVA $JAVA_OPTS $ES_JAVA_OPTS $es_parms -cp $ES_CLASSPATH $props \
|
||||||
org.elasticsearch.Version
|
org.elasticsearch.Version
|
||||||
|
|
|
@ -18,10 +18,10 @@ done
|
||||||
ES_HOME=`dirname "$SCRIPT"`/..
|
ES_HOME=`dirname "$SCRIPT"`/..
|
||||||
|
|
||||||
# make ELASTICSEARCH_HOME absolute
|
# make ELASTICSEARCH_HOME absolute
|
||||||
ES_HOME=`cd $ES_HOME; pwd`
|
ES_HOME=`cd "$ES_HOME"; pwd`
|
||||||
|
|
||||||
|
|
||||||
if [ -x $JAVA_HOME/bin/java ]; then
|
if [ -x "$JAVA_HOME/bin/java" ]; then
|
||||||
JAVA=$JAVA_HOME/bin/java
|
JAVA=$JAVA_HOME/bin/java
|
||||||
else
|
else
|
||||||
JAVA=`which java`
|
JAVA=`which java`
|
||||||
|
@ -29,5 +29,4 @@ fi
|
||||||
|
|
||||||
CLASSPATH=$CLASSPATH:$ES_HOME/lib/*
|
CLASSPATH=$CLASSPATH:$ES_HOME/lib/*
|
||||||
|
|
||||||
$JAVA -Delasticsearch -Des.path.home=$ES_HOME -cp $CLASSPATH org.elasticsearch.plugins.PluginManager $*
|
exec $JAVA -Delasticsearch -Des.path.home="$ES_HOME" -cp $CLASSPATH org.elasticsearch.plugins.PluginManager $*
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue