diff --git a/distribution/src/main/resources/bin/elasticsearch b/distribution/src/main/resources/bin/elasticsearch index 8407697509e..aa90e7c510d 100755 --- a/distribution/src/main/resources/bin/elasticsearch +++ b/distribution/src/main/resources/bin/elasticsearch @@ -54,6 +54,33 @@ EOF exit 1 fi +# TODO: remove for Elasticsearch 6.x +unsupported_environment_variable() { + if [ ! -z "$1" ]; then + echo "$2=$1" + fi +} + +if [[ !(-z "$ES_MIN_MEM" && + -z "$ES_MAX_MEM" && + -z "$ES_HEAP_SIZE" && + -z "$ES_HEAP_NEWSIZE" && + -z "$ES_DIRECT_SIZE" && + -z "$ES_USE_IPV4" && + -z "$ES_GC_OPTS") ]]; then + echo "Error: encountered environment variables that are no longer supported" + echo "Use jvm.options or ES_JAVA_OPTS to configure the JVM" + unsupported_environment_variable "$ES_MIN_MEM" ES_MIN_MEM + unsupported_environment_variable "$ES_MAX_MEM" ES_MAX_MEM + unsupported_environment_variable "$ES_HEAP_SIZE" ES_HEAP_SIZE + unsupported_environment_variable "$ES_HEAP_NEWSIZE" ES_HEAP_NEWSIZE + unsupported_environment_variable "$ES_DIRECT_SIZE" ES_DIRECT_SIZE + unsupported_environment_variable "$ES_USE_IPV4" ES_USE_IPV4 + unsupported_environment_variable "$ES_GC_OPTS" ES_GC_OPTS + exit 1 +fi +# end TODO: remove for Elasticsearch 6.x + parse_jvm_options() { if [ -f "$1" ]; then echo "$(grep "^-" "$1" | tr '\n' ' ')" diff --git a/distribution/src/main/resources/bin/elasticsearch.bat b/distribution/src/main/resources/bin/elasticsearch.bat index 11febd676d7..e8683186e0f 100644 --- a/distribution/src/main/resources/bin/elasticsearch.bat +++ b/distribution/src/main/resources/bin/elasticsearch.bat @@ -5,6 +5,28 @@ TITLE Elasticsearch ${project.version} SET params='%*' +rem TODO: remove for Elasticsearch 6.x +if not "%ES_MIN_MEM%" == "" set bad_env_var=1 +if not "%ES_MAX_MEM%" == "" set bad_env_var=1 +if not "%ES_HEAP_SIZE%" == "" set bad_env_var=1 +if not "%ES_HEAP_NEWSIZE%" == "" set bad_env_var=1 +if not "%ES_DIRECT_SIZE%" == "" set bad_env_var=1 +if not "%ES_USE_IPV4%" == "" set bad_env_var=1 +if not "%ES_GC_OPTS%" == "" set bad_env_var=1 +if %bad_env_var% == 1 ( + echo Error: encountered environment variables that are no longer supported + echo Use jvm.options or ES_JAVA_OPTS to configure the JVM + if not "%ES_MIN_MEM%" == "" echo ES_MIN_MEM=%ES_MIN_MEM% + if not "%ES_MAX_MEM%" == "" echo ES_MAX_MEM=%ES_MAX_MEM% + if not "%ES_HEAP_SIZE%" == "" echo ES_HEAP_SIZE=%ES_HEAP_SIZE% + if not "%ES_HEAP_NEWSIZE%" == "" echo ES_HEAP_NEWSIZE=%ES_HEAP_NEWSIZE% + if not "%ES_DIRECT_SIZE%" == "" echo ES_DIRECT_SIZE=%ES_DIRECT_SIZE% + if not "%ES_USE_IPV4%" == "" echo ES_USE_IPV4=%ES_USE_IPV4% + if not "%ES_GC_OPTS%" == "" echo ES_GC_OPTS=%ES_GC_OPTS% + exit /b 1 +) +rem end TODO: remove for Elasticsearch 6.x + :loop FOR /F "usebackq tokens=1* delims= " %%A IN (!params!) DO ( SET current=%%A diff --git a/distribution/src/main/resources/bin/service.bat b/distribution/src/main/resources/bin/service.bat index 208a31ce799..a6f9988de27 100644 --- a/distribution/src/main/resources/bin/service.bat +++ b/distribution/src/main/resources/bin/service.bat @@ -3,6 +3,28 @@ SETLOCAL enabledelayedexpansion TITLE Elasticsearch Service ${project.version} +rem TODO: remove for Elasticsearch 6.x +if not "%ES_MIN_MEM%" == "" set bad_env_var=1 +if not "%ES_MAX_MEM%" == "" set bad_env_var=1 +if not "%ES_HEAP_SIZE%" == "" set bad_env_var=1 +if not "%ES_HEAP_NEWSIZE%" == "" set bad_env_var=1 +if not "%ES_DIRECT_SIZE%" == "" set bad_env_var=1 +if not "%ES_USE_IPV4%" == "" set bad_env_var=1 +if not "%ES_GC_OPTS%" == "" set bad_env_var=1 +if %bad_env_var% == 1 ( + echo Error: encountered environment variables that are no longer supported + echo Use jvm.options or ES_JAVA_OPTS to configure the JVM + if not "%ES_MIN_MEM%" == "" echo ES_MIN_MEM=%ES_MIN_MEM% + if not "%ES_MAX_MEM%" == "" echo ES_MAX_MEM=%ES_MAX_MEM% + if not "%ES_HEAP_SIZE%" == "" echo ES_HEAP_SIZE=%ES_HEAP_SIZE% + if not "%ES_HEAP_NEWSIZE%" == "" echo ES_HEAP_NEWSIZE=%ES_HEAP_NEWSIZE% + if not "%ES_DIRECT_SIZE%" == "" echo ES_DIRECT_SIZE=%ES_DIRECT_SIZE% + if not "%ES_USE_IPV4%" == "" echo ES_USE_IPV4=%ES_USE_IPV4% + if not "%ES_GC_OPTS%" == "" echo ES_GC_OPTS=%ES_GC_OPTS% + exit /b 1 +) +rem end TODO: remove for Elasticsearch 6.x + if NOT DEFINED JAVA_HOME goto err if not "%CONF_FILE%" == "" goto conffileset