httpfs.sh 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #!/bin/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.
  14. #
  15. # resolve links - $0 may be a softlink
  16. PRG="${0}"
  17. while [ -h "${PRG}" ]; do
  18. ls=`ls -ld "${PRG}"`
  19. link=`expr "$ls" : '.*-> \(.*\)$'`
  20. if expr "$link" : '/.*' > /dev/null; then
  21. PRG="$link"
  22. else
  23. PRG=`dirname "${PRG}"`/"$link"
  24. fi
  25. done
  26. BASEDIR=`dirname ${PRG}`
  27. BASEDIR=`cd ${BASEDIR}/..;pwd`
  28. source ${BASEDIR}/libexec/httpfs-config.sh
  29. # The Java System property 'httpfs.http.port' it is not used by HttpFS,
  30. # it is used in Tomcat's server.xml configuration file
  31. #
  32. print "Using CATALINA_OPTS: ${CATALINA_OPTS}"
  33. catalina_opts="-Dhttpfs.home.dir=${HTTPFS_HOME}";
  34. catalina_opts="${catalina_opts} -Dhttpfs.config.dir=${HTTPFS_CONFIG}";
  35. catalina_opts="${catalina_opts} -Dhttpfs.log.dir=${HTTPFS_LOG}";
  36. catalina_opts="${catalina_opts} -Dhttpfs.temp.dir=${HTTPFS_TEMP}";
  37. catalina_opts="${catalina_opts} -Dhttpfs.admin.port=${HTTPFS_ADMIN_PORT}";
  38. catalina_opts="${catalina_opts} -Dhttpfs.http.port=${HTTPFS_HTTP_PORT}";
  39. catalina_opts="${catalina_opts} -Dhttpfs.http.hostname=${HTTPFS_HTTP_HOSTNAME}";
  40. print "Adding to CATALINA_OPTS: ${catalina_opts}"
  41. export CATALINA_OPTS="${CATALINA_OPTS} ${catalina_opts}"
  42. # A bug in catalina.sh script does not use CATALINA_OPTS for stopping the server
  43. #
  44. if [ "${1}" = "stop" ]; then
  45. export JAVA_OPTS=${CATALINA_OPTS}
  46. fi
  47. if [ "${HTTPFS_SILENT}" != "true" ]; then
  48. ${CATALINA_BASE:-"${BASEDIR}/share/hadoop/httpfs/tomcat"}/bin/catalina.sh "$@"
  49. else
  50. ${CATALINA_BASE:-"${BASEDIR}/share/hadoop/httpfs/tomcat"}/bin/catalina.sh "$@" > /dev/null
  51. fi