"Fossies" - the Fresh Open Source Software Archive

Member "elasticsearch-6.8.23/bin/elasticsearch-env" (6 Jan 2022, 2222 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 set -e -o pipefail
    4 
    5 CDPATH=""
    6 
    7 SCRIPT="$0"
    8 
    9 # SCRIPT might be an arbitrarily deep series of symbolic links; loop until we
   10 # have the concrete path
   11 while [ -h "$SCRIPT" ] ; do
   12   ls=`ls -ld "$SCRIPT"`
   13   # Drop everything prior to ->
   14   link=`expr "$ls" : '.*-> \(.*\)$'`
   15   if expr "$link" : '/.*' > /dev/null; then
   16     SCRIPT="$link"
   17   else
   18     SCRIPT=`dirname "$SCRIPT"`/"$link"
   19   fi
   20 done
   21 
   22 # determine Elasticsearch home; to do this, we strip from the path until we find
   23 # bin, and then strip bin (there is an assumption here that there is no nested
   24 # directory under bin also named bin)
   25 ES_HOME=`dirname "$SCRIPT"`
   26 
   27 # now make ES_HOME absolute
   28 ES_HOME=`cd "$ES_HOME"; pwd`
   29 
   30 while [ "`basename "$ES_HOME"`" != "bin" ]; do
   31   ES_HOME=`dirname "$ES_HOME"`
   32 done
   33 ES_HOME=`dirname "$ES_HOME"`
   34 
   35 # now set the classpath
   36 ES_CLASSPATH="$ES_HOME/lib/*"
   37 
   38 # now set the path to java
   39 if [ -x "$JAVA_HOME/bin/java" ]; then
   40   JAVA="$JAVA_HOME/bin/java"
   41 else
   42   set +e
   43   JAVA=`which java`
   44   echo "warning: Falling back to java on path. This behavior is deprecated. Specify JAVA_HOME"
   45   set -e
   46 fi
   47 
   48 if [ ! -x "$JAVA" ]; then
   49   echo "could not find java; set JAVA_HOME" >&2
   50   exit 1
   51 fi
   52 
   53 # do not let JAVA_TOOL_OPTIONS slip in (as the JVM does by default)
   54 if [ ! -z "$JAVA_TOOL_OPTIONS" ]; then
   55   echo "warning: ignoring JAVA_TOOL_OPTIONS=$JAVA_TOOL_OPTIONS"
   56   unset JAVA_TOOL_OPTIONS
   57 fi
   58 
   59 # JAVA_OPTS is not a built-in JVM mechanism but some people think it is so we
   60 # warn them that we are not observing the value of $JAVA_OPTS
   61 if [ ! -z "$JAVA_OPTS" ]; then
   62   echo -n "warning: ignoring JAVA_OPTS=$JAVA_OPTS; "
   63   echo "pass JVM parameters via ES_JAVA_OPTS"
   64 fi
   65 
   66 # check the Java version
   67 "$JAVA" -cp "$ES_CLASSPATH" org.elasticsearch.tools.java_version_checker.JavaVersionChecker
   68 
   69 export HOSTNAME=$HOSTNAME
   70 
   71 if [ -z "$ES_PATH_CONF" ]; then ES_PATH_CONF="$ES_HOME"/config; fi
   72 
   73 if [ -z "$ES_PATH_CONF" ]; then
   74   echo "ES_PATH_CONF must be set to the configuration path"
   75   exit 1
   76 fi
   77 
   78 # now make ES_PATH_CONF absolute
   79 ES_PATH_CONF=`cd "$ES_PATH_CONF"; pwd`
   80 
   81 ES_DISTRIBUTION_FLAVOR=default
   82 ES_DISTRIBUTION_TYPE=tar
   83 
   84 if [ -z "$ES_TMPDIR" ]; then
   85   ES_TMPDIR=`"$JAVA" -cp "$ES_CLASSPATH" org.elasticsearch.tools.launchers.TempDirectory`
   86 fi