# Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. HADOOP_NAME="namenode" DAEMON="hadoop-hdfs-$HADOOP_NAME" DESC="Hadoop $HADOOP_NAME" EXEC_PATH="/usr/lib/hadoop/sbin/hadoop-daemon.sh" SVC_USER="hdfs" DAEMON_FLAGS="$HADOOP_NAME" CONF_DIR="/etc/hadoop/conf" PIDFILE="/var/run/hadoop-hdfs/hadoop-$SVC_USER-$HADOOP_NAME.pid" LOCKDIR="/var/lock/subsys" LOCKFILE="hadoop-$HADOOP_NAME" generate_extra_commands() { cat <<'__EOT__' upgrade|rollback) DAEMON_FLAGS="$DAEMON_FLAGS -${1}" start ;; init) check_for_root checkstatusofproc if [ "$?" = "$STATUS_RUNNING" ] ; then echo "Error: $DESC is running. Stop it first." exit 1 else su -s /bin/bash $SVC_USER -c "hdfs namenode -format" fi ;; *) echo $"Usage: $0 {start|stop|status|restart|try-restart|condrestart|upgrade|rollback|init}" exit 1 __EOT__ }