"Fossies" - the Fresh Open Source Software Archive

Member "elasticsearch-6.8.23/bin/elasticsearch" (6 Jan 2022, 2250 Bytes) of package /linux/www/elasticsearch-6.8.23.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Bash source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 #!/bin/bash
    2 
    3 # CONTROLLING STARTUP:
    4 #
    5 # This script relies on a few environment variables to determine startup
    6 # behavior, those variables are:
    7 #
    8 #   ES_PATH_CONF -- Path to config directory
    9 #   ES_JAVA_OPTS -- External Java Opts on top of the defaults set
   10 #
   11 # Optionally, exact memory values can be set using the `ES_JAVA_OPTS`. Note that
   12 # the Xms and Xmx lines in the JVM options file must be commented out. Example
   13 # values are "512m", and "10g".
   14 #
   15 #   ES_JAVA_OPTS="-Xms8g -Xmx8g" ./bin/elasticsearch
   16 
   17 source "`dirname "$0"`"/elasticsearch-env
   18 
   19 ES_JVM_OPTIONS="$ES_PATH_CONF"/jvm.options
   20 JVM_OPTIONS=`"$JAVA" -cp "$ES_CLASSPATH" org.elasticsearch.tools.launchers.JvmOptionsParser "$ES_JVM_OPTIONS"`
   21 ES_JAVA_OPTS="${JVM_OPTIONS//\$\{ES_TMPDIR\}/$ES_TMPDIR} $ES_JAVA_OPTS"
   22 
   23 # If the quote-aware filesystem plugin is installed, then we need to pass extra
   24 # flags to Java in order to use the plugin.
   25 if [[ -d "$ES_HOME/plugins/quota-aware-fs" ]]; then
   26   PLUGIN_JAR_PATH="$(find "$ES_HOME/plugins/quota-aware-fs" -name quota-aware-fs\*.jar)"
   27   ES_JAVA_OPTS="$ES_JAVA_OPTS -Djava.nio.file.spi.DefaultFileSystemProvider=org.elasticsearch.fs.quotaaware.QuotaAwareFileSystemProvider"
   28   ES_JAVA_OPTS="$ES_JAVA_OPTS -Xbootclasspath/a:$PLUGIN_JAR_PATH"
   29 fi
   30 
   31 cd "$ES_HOME"
   32 # manual parsing to find out, if process should be detached
   33 if ! echo $* | grep -E '(^-d |-d$| -d |--daemonize$|--daemonize )' > /dev/null; then
   34   exec \
   35     "$JAVA" \
   36     $ES_JAVA_OPTS \
   37     -Des.path.home="$ES_HOME" \
   38     -Des.path.conf="$ES_PATH_CONF" \
   39     -Des.distribution.flavor="$ES_DISTRIBUTION_FLAVOR" \
   40     -Des.distribution.type="$ES_DISTRIBUTION_TYPE" \
   41     -cp "$ES_CLASSPATH" \
   42     org.elasticsearch.bootstrap.Elasticsearch \
   43     "$@"
   44 else
   45   exec \
   46     "$JAVA" \
   47     $ES_JAVA_OPTS \
   48     -Des.path.home="$ES_HOME" \
   49     -Des.path.conf="$ES_PATH_CONF" \
   50     -Des.distribution.flavor="$ES_DISTRIBUTION_FLAVOR" \
   51     -Des.distribution.type="$ES_DISTRIBUTION_TYPE" \
   52     -cp "$ES_CLASSPATH" \
   53     org.elasticsearch.bootstrap.Elasticsearch \
   54     "$@" \
   55     <&- &
   56   retval=$?
   57   pid=$!
   58   [ $retval -eq 0 ] || exit $retval
   59   if [ ! -z "$ES_STARTUP_SLEEP_TIME" ]; then
   60     sleep $ES_STARTUP_SLEEP_TIME
   61   fi
   62   if ! ps -p $pid > /dev/null ; then
   63     exit 1
   64   fi
   65   exit 0
   66 fi
   67 
   68 exit $?