hadoop-historyserver 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. #!/bin/bash
  2. # Licensed to the Apache Software Foundation (ASF) under one or more
  3. # contributor license agreements. See the NOTICE file distributed with
  4. # this work for additional information regarding copyright ownership.
  5. # The ASF licenses this file to You under the Apache License, Version 2.0
  6. # (the "License"); you may not use this file except in compliance with
  7. # the License. You may obtain a copy of the License at
  8. #
  9. # http://www.apache.org/licenses/LICENSE-2.0
  10. #
  11. # Unless required by applicable law or agreed to in writing, software
  12. # distributed under the License is distributed on an "AS IS" BASIS,
  13. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. # See the License for the specific language governing permissions and
  15. # limitations under the License.
  16. #
  17. # Starts a Hadoop historyserver
  18. #
  19. # chkconfig: 2345 90 10
  20. # description: Hadoop historyserver
  21. source /etc/rc.d/init.d/functions
  22. source /etc/default/hadoop-env.sh
  23. RETVAL=0
  24. PIDFILE="${HADOOP_PID_DIR}/hadoop-mapred-historyserver.pid"
  25. desc="Hadoop historyserver daemon"
  26. export HADOOP_PREFIX=${HADOOP_PREFIX:-/usr}
  27. start() {
  28. echo -n $"Starting $desc (hadoop-historyserver): "
  29. daemon --user mapred ${HADOOP_PREFIX}/sbin/hadoop-daemon.sh --config "${HADOOP_CONF_DIR}" start historyserver
  30. RETVAL=$?
  31. echo
  32. [ $RETVAL -eq 0 ] && touch /var/lock/subsys/hadoop-historyserver
  33. return $RETVAL
  34. }
  35. stop() {
  36. echo -n $"Stopping $desc (hadoop-historyserver): "
  37. daemon --user mapred ${HADOOP_PREFIX}/sbin/hadoop-daemon.sh --config "${HADOOP_CONF_DIR}" stop historyserver
  38. RETVAL=$?
  39. sleep 5
  40. echo
  41. [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/hadoop-historyserver $PIDFILE
  42. }
  43. restart() {
  44. stop
  45. start
  46. }
  47. checkstatus(){
  48. status -p $PIDFILE ${JAVA_HOME}/bin/java
  49. RETVAL=$?
  50. }
  51. condrestart(){
  52. [ -e /var/lock/subsys/hadoop-historyserver ] && restart || :
  53. }
  54. case "$1" in
  55. start)
  56. start
  57. ;;
  58. stop)
  59. stop
  60. ;;
  61. status)
  62. checkstatus
  63. ;;
  64. restart)
  65. restart
  66. ;;
  67. condrestart)
  68. condrestart
  69. ;;
  70. *)
  71. echo $"Usage: $0 {start|stop|status|restart|condrestart}"
  72. exit 1
  73. esac
  74. exit $RETVAL