ambari-server 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. #!/usr/bin/env bash
  2. # chkconfig: 345 20 80
  3. # description: ambari-server daemon
  4. # processname: ambari-server
  5. # Licensed to the Apache Software Foundation (ASF) under one
  6. # or more contributor license agreements. See the NOTICE file
  7. # distributed with this work for additional information
  8. # regarding copyright ownership. The ASF licenses this file
  9. # to you under the Apache License, Version 2.0 (the
  10. # "License"); you may not use this file except in compliance
  11. # with the License. You may obtain a copy of the License at
  12. #
  13. # http://www.apache.org/licenses/LICENSE-2.0
  14. #
  15. # Unless required by applicable law or agreed to in writing, software
  16. # distributed under the License is distributed on an "AS IS" BASIS,
  17. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  18. # See the License for the specific language governing permissions and
  19. # limitations under the License.
  20. # /etc/init.d/ambari-server
  21. VERSION="${ambariVersion}"
  22. HASH="${buildNumber}"
  23. case "$1" in
  24. --version)
  25. echo -e $VERSION
  26. exit 0
  27. ;;
  28. --hash)
  29. echo -e $HASH
  30. exit 0
  31. ;;
  32. esac
  33. export PATH=/usr/lib/ambari-server/*:$PATH
  34. export AMBARI_CONF_DIR=/etc/ambari-server/conf:$PATH
  35. if [ -a /usr/bin/python2.6 ]; then
  36. PYTHON=/usr/bin/python2.6
  37. fi
  38. if [ -a /var/lib/ambari-server/ambari-env.sh ]; then
  39. . /var/lib/ambari-server/ambari-env.sh
  40. fi
  41. if [ -z "$PYTHON" ]; then
  42. PYTHON=/usr/bin/python
  43. fi
  44. if [ -z "$AMBARI_PASSPHRASE" ]; then
  45. AMBARI_PASSPHRASE="DEV"
  46. fi
  47. if [ -n "$JAVA_HOME" ]; then
  48. export JAVA_HOME=$JAVA_HOME
  49. fi
  50. export AMBARI_PASSPHRASE=$AMBARI_PASSPHRASE
  51. # check for version
  52. majversion=`$PYTHON -V 2>&1 | awk '{print $2}' | cut -d'.' -f1`
  53. minversion=`$PYTHON -V 2>&1 | awk '{print $2}' | cut -d'.' -f2`
  54. numversion=$(( 10 * $majversion + $minversion))
  55. if (( $numversion < 26 )); then
  56. echo "Need python version > 2.6"
  57. exit 1
  58. fi
  59. echo "Using python " $PYTHON
  60. case "$1" in
  61. start)
  62. echo -e "Starting ambari-server"
  63. $PYTHON /usr/sbin/ambari-server.py $@
  64. ;;
  65. stop)
  66. echo -e "Stopping ambari-server"
  67. $PYTHON /usr/sbin/ambari-server.py $@
  68. ;;
  69. reset)
  70. echo -e "Resetting ambari-server"
  71. $PYTHON /usr/sbin/ambari-server.py $@
  72. ;;
  73. restart)
  74. echo -e "Restarting ambari-server"
  75. $0 stop
  76. $0 start
  77. ;;
  78. upgrade)
  79. echo -e "Upgrading ambari-server"
  80. $PYTHON /usr/sbin/ambari-server.py $@
  81. ;;
  82. status)
  83. echo -e "Ambari-server status"
  84. $PYTHON /usr/sbin/ambari-server.py $@
  85. ;;
  86. upgradestack)
  87. echo -e "Upgrading stack of ambari-server"
  88. $PYTHON /usr/sbin/ambari-server.py $@
  89. ;;
  90. update-metainfo)
  91. echo -e "Updating ambari-server meta information"
  92. $PYTHON /usr/sbin/ambari-server.py $@
  93. ;;
  94. setup)
  95. echo -e "Setup ambari-server"
  96. $PYTHON /usr/sbin/ambari-server.py $@
  97. ;;
  98. setup-ldap)
  99. echo -e "Setting up LDAP properties..."
  100. $PYTHON /usr/sbin/ambari-server.py $@
  101. ;;
  102. setup-security)
  103. echo -e "Security setup options..."
  104. $PYTHON /usr/sbin/ambari-server.py $@
  105. ;;
  106. *)
  107. echo "Usage: /usr/sbin/ambari-server
  108. {start|stop|restart|setup|upgrade|status|upgradestack|setup-ldap|setup-security} [options]
  109. Use usr/sbin/ambari-server <action> --help to get details on options available.
  110. Or, simply invoke ambari-server.py --help to print the options."
  111. exit 1
  112. esac
  113. exit 0