From 12f83b380a9bf55f793cc166f495ff543296e1dc Mon Sep 17 00:00:00 2001 From: Eli Collins Date: Thu, 2 Feb 2012 18:45:47 +0000 Subject: [PATCH] HADOOP-8012. svn merge -c 1239752 from trunk git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-0.23@1239753 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-common-project/hadoop-common/CHANGES.txt | 3 +++ .../hadoop-common/src/main/bin/hadoop-daemon.sh | 9 ++++++--- hadoop-mapreduce-project/hadoop-yarn/bin/yarn-daemon.sh | 9 ++++++--- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt index 1ff2f3fa963..88be885d81b 100644 --- a/hadoop-common-project/hadoop-common/CHANGES.txt +++ b/hadoop-common-project/hadoop-common/CHANGES.txt @@ -197,6 +197,9 @@ Release 0.23.1 - Unreleased HADOOP-7999. "hadoop archive" fails with ClassNotFoundException. (Jason Lowe via mahadev) + HADOOP-8012. hadoop-daemon.sh and yarn-daemon.sh are trying to mkdir + and chown log/pid dirs which can fail. (Roman Shaposhnik via eli) + Release 0.23.0 - 2011-11-01 INCOMPATIBLE CHANGES diff --git a/hadoop-common-project/hadoop-common/src/main/bin/hadoop-daemon.sh b/hadoop-common-project/hadoop-common/src/main/bin/hadoop-daemon.sh index a843c93cbf6..abd4dfd4781 100755 --- a/hadoop-common-project/hadoop-common/src/main/bin/hadoop-daemon.sh +++ b/hadoop-common-project/hadoop-common/src/main/bin/hadoop-daemon.sh @@ -95,8 +95,11 @@ fi if [ "$HADOOP_LOG_DIR" = "" ]; then export HADOOP_LOG_DIR="$HADOOP_PREFIX/logs" fi -mkdir -p "$HADOOP_LOG_DIR" -chown $HADOOP_IDENT_STRING $HADOOP_LOG_DIR + +if [ ! -w "$HADOOP_LOG_DIR" ] ; then + mkdir -p "$HADOOP_LOG_DIR" + chown $HADOOP_IDENT_STRING $HADOOP_LOG_DIR +fi if [ "$HADOOP_PID_DIR" = "" ]; then HADOOP_PID_DIR=/tmp @@ -118,7 +121,7 @@ case $startStop in (start) - mkdir -p "$HADOOP_PID_DIR" + [ -w "$HADOOP_PID_DIR" ] || mkdir -p "$HADOOP_PID_DIR" if [ -f $pid ]; then if kill -0 `cat $pid` > /dev/null 2>&1; then diff --git a/hadoop-mapreduce-project/hadoop-yarn/bin/yarn-daemon.sh b/hadoop-mapreduce-project/hadoop-yarn/bin/yarn-daemon.sh index 6e41f791c3e..1fa43d8b1b2 100644 --- a/hadoop-mapreduce-project/hadoop-yarn/bin/yarn-daemon.sh +++ b/hadoop-mapreduce-project/hadoop-yarn/bin/yarn-daemon.sh @@ -78,8 +78,11 @@ fi if [ "$YARN_LOG_DIR" = "" ]; then export YARN_LOG_DIR="$YARN_HOME/logs" fi -mkdir -p "$YARN_LOG_DIR" -chown $YARN_IDENT_STRING $YARN_LOG_DIR + +if [ ! -w "$YARN_LOG_DIR" ] ; then + mkdir -p "$YARN_LOG_DIR" + chown $YARN_IDENT_STRING $YARN_LOG_DIR +fi if [ "$YARN_PID_DIR" = "" ]; then YARN_PID_DIR=/tmp @@ -101,7 +104,7 @@ case $startStop in (start) - mkdir -p "$YARN_PID_DIR" + [ -w "$YARN_PID_DIR" ] || mkdir -p "$YARN_PID_DIR" if [ -f $pid ]; then if kill -0 `cat $pid` > /dev/null 2>&1; then