Skip to content
This repository has been archived by the owner on Nov 15, 2018. It is now read-only.

Commit

Permalink
Select class name from ES version
Browse files Browse the repository at this point in the history
  • Loading branch information
caruccio committed Feb 4, 2014
1 parent 224c400 commit 95c67e0
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions usr/bin/elasticsearch
Original file line number Diff line number Diff line change
Expand Up @@ -123,17 +123,21 @@ launch_service()
es_parms="$es_parms -Des.pidfile=$pidpath"
fi

if [ "${ELASTICSEARCH_VERSION%%.*}" == '1' ]; then
class_name=org.elasticsearch.bootstrap.Elasticsearch
else
class_name=org.elasticsearch.bootstrap.ElasticSearch
fi

# The es-foreground option will tell ElasticSearch not to close stdout/stderr, but it's up to us not to background.
if [ "x$foreground" != "x" ]; then
es_parms="$es_parms -Des.foreground=yes"
exec "$JAVA" $JAVA_OPTS $ES_JAVA_OPTS $es_parms -Des.path.home="$ES_HOME" -cp "$ES_CLASSPATH" $props \
org.elasticsearch.bootstrap.ElasticSearch
exec "$JAVA" $JAVA_OPTS $ES_JAVA_OPTS $es_parms -Des.path.home="$ES_HOME" -cp "$ES_CLASSPATH" $props $class_name
# exec without running it in the background, makes it replace this shell, we'll never get here...
# no need to return something
else
# Startup ElasticSearch, background it, and write the pid.
exec "$JAVA" $JAVA_OPTS $ES_JAVA_OPTS $es_parms -Des.path.home="$ES_HOME" -cp "$ES_CLASSPATH" $props \
org.elasticsearch.bootstrap.Elasticsearch <&- &
exec "$JAVA" $JAVA_OPTS $ES_JAVA_OPTS $es_parms -Des.path.home="$ES_HOME" -cp "$ES_CLASSPATH" $props $class_name <&- &
return $?
fi
}
Expand Down

0 comments on commit 95c67e0

Please sign in to comment.