start-estimator.sh 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #!/usr/bin/env bash
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License. See accompanying LICENSE file.
  14. #
  15. # let's locate libexec...
  16. if [[ -n "${HADOOP_HOME}" ]]; then
  17. HADOOP_DEFAULT_LIBEXEC_DIR="${HADOOP_HOME}/libexec"
  18. else
  19. this="${BASH_SOURCE-$0}"
  20. bin=$(cd -P -- "$(dirname -- "${this}")" >/dev/null && pwd -P)
  21. HADOOP_DEFAULT_LIBEXEC_DIR="${bin}/../../../../../libexec"
  22. fi
  23. HADOOP_LIBEXEC_DIR="${HADOOP_LIBEXEC_DIR:-$HADOOP_DEFAULT_LIBEXEC_DIR}"
  24. # shellcheck disable=SC2034
  25. HADOOP_NEW_CONFIG=true
  26. if [[ -f "${HADOOP_LIBEXEC_DIR}/hadoop-config.sh" ]]; then
  27. # shellcheck source=./hadoop-common-project/hadoop-common/src/main/bin/hadoop-config.sh
  28. . "${HADOOP_LIBEXEC_DIR}/hadoop-config.sh"
  29. else
  30. echo "ERROR: Cannot execute ${HADOOP_LIBEXEC_DIR}/hadoop-config.sh." 2>&1
  31. exit 1
  32. fi
  33. # start resource estimator
  34. echo "Starting resource estimator"
  35. hadoop_uservar_su estimator resourceestimator "bin/estimator.sh" \
  36. --config "${HADOOP_CONF_DIR}" \
  37. --daemon start \
  38. resourceestimator
  39. (( HADOOP_JUMBO_RETCOUNTER=HADOOP_JUMBO_RETCOUNTER + $? ))