hadoop-secondarynamenode 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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 secondarynamenode
  18. #
  19. # chkconfig: 2345 90 10
  20. # description: Hadoop secondarynamenode
  21. source /etc/rc.d/init.d/functions
  22. source /etc/default/hadoop-env.sh
  23. RETVAL=0
  24. PIDFILE="${HADOOP_PID_DIR}/hadoop-hdfs-secondarynamenode.pid"
  25. desc="Hadoop secondary namenode daemon"
  26. export HADOOP_PREFIX=${HADOOP_PREFIX:-/usr}
  27. start() {
  28. echo -n $"Starting $desc (hadoop-secondarynamenode): "
  29. daemon --user hdfs ${HADOOP_PREFIX}/sbin/hadoop-daemon.sh --config "${HADOOP_CONF_DIR}" start secondarynamenode $1
  30. RETVAL=$?
  31. echo
  32. [ $RETVAL -eq 0 ] && touch /var/lock/subsys/hadoop-secondarynamenode
  33. return $RETVAL
  34. }
  35. upgrade() {
  36. start -upgrade
  37. }
  38. stop() {
  39. echo -n $"Stopping $desc (hadoop-secondarynamenode): "
  40. daemon --user hdfs ${HADOOP_PREFIX}/sbin/hadoop-daemon.sh --config "${HADOOP_CONF_DIR}" stop secondarynamenode
  41. RETVAL=$?
  42. sleep 5
  43. echo
  44. [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/hadoop-secondarynamenode $PIDFILE
  45. }
  46. checkstatus(){
  47. status -p $PIDFILE ${JAVA_HOME}/bin/java
  48. RETVAL=$?
  49. }
  50. restart() {
  51. stop
  52. start
  53. }
  54. condrestart(){
  55. [ -e /var/lock/subsys/hadoop-secondarynamenode ] && restart || :
  56. }
  57. case "$1" in
  58. start)
  59. start
  60. ;;
  61. upgrade)
  62. upgrade
  63. ;;
  64. stop)
  65. stop
  66. ;;
  67. status)
  68. checkstatus
  69. ;;
  70. restart)
  71. restart
  72. ;;
  73. condrestart|try-restart)
  74. condrestart
  75. ;;
  76. *)
  77. echo $"Usage: $0 {start|stop|status|restart|try-restart|upgrade}"
  78. exit 1
  79. esac
  80. exit $RETVAL