You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@drill.apache.org by ja...@apache.org on 2015/03/26 07:26:42 UTC

[03/10] drill git commit: DRILL-2446: Improvement in finding Drill log dir

DRILL-2446: Improvement in finding Drill log dir


Project: http://git-wip-us.apache.org/repos/asf/drill/repo
Commit: http://git-wip-us.apache.org/repos/asf/drill/commit/b559cc6e
Tree: http://git-wip-us.apache.org/repos/asf/drill/tree/b559cc6e
Diff: http://git-wip-us.apache.org/repos/asf/drill/diff/b559cc6e

Branch: refs/heads/0.8.0
Commit: b559cc6ef692bef8edad4789846b21be6fe3d4bb
Parents: 83a726c
Author: Patrick Wong <pw...@maprtech.com>
Authored: Thu Mar 12 14:48:05 2015 -0700
Committer: Jacques Nadeau <ja...@apache.org>
Committed: Tue Mar 24 18:13:40 2015 -0700

----------------------------------------------------------------------
 distribution/src/resources/drill-config.sh | 25 +++++++++++++------------
 1 file changed, 13 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/drill/blob/b559cc6e/distribution/src/resources/drill-config.sh
----------------------------------------------------------------------
diff --git a/distribution/src/resources/drill-config.sh b/distribution/src/resources/drill-config.sh
index 0ee181d..7ddec65 100644
--- a/distribution/src/resources/drill-config.sh
+++ b/distribution/src/resources/drill-config.sh
@@ -78,20 +78,21 @@ fi
 . "${DRILL_CONF_DIR}/drill-env.sh"
 
 # get log directory
-if [ "$DRILL_LOG_DIR" = "" ]; then
-  DRILL_LOG_DIR=/var/log/drill
-  touch $DRILL_LOG_DIR/sqlline.log
-  TOUCH_EXIT_CODE=$?
-  if [ $TOUCH_EXIT_CODE = 0 ]; then
-    echo "Default Drill log directory: $DRILL_LOG_DIR"
-    DRILL_LOG_DIR_FALLBACK=0
-  else
-    #Force DRILL_LOG_DIR to fall back
-    DRILL_LOG_DIR_FALLBACK=1
-  fi
+if [ "x${DRILL_LOG_DIR}" = "x" ]; then
+  export DRILL_LOG_DIR=/var/log/drill
+fi
+
+touch "$DRILL_LOG_DIR/sqlline.log" &> /dev/null
+TOUCH_EXIT_CODE=$?
+if [ "$TOUCH_EXIT_CODE" = "0" ]; then
+  echo "Drill log directory: $DRILL_LOG_DIR"
+  DRILL_LOG_DIR_FALLBACK=0
+else
+  #Force DRILL_LOG_DIR to fall back
+  DRILL_LOG_DIR_FALLBACK=1
 fi
 
-if [ ! -d $DRILL_LOG_DIR ] || [ $DRILL_LOG_DIR_FALLBACK = 1 ]; then
+if [ ! -d "$DRILL_LOG_DIR" ] || [ "$DRILL_LOG_DIR_FALLBACK" = "1" ]; then
   echo "Drill log directory $DRILL_LOG_DIR does not exist or is not writable, defaulting to $DRILL_HOME/log"
   DRILL_LOG_DIR=$DRILL_HOME/log
   mkdir -p $DRILL_LOG_DIR