Repository: drill
Updated Branches:
  refs/heads/master b3bdc2790 -> 710656a19


DRILL-1719 - handle the case in which /var/log/drill exists but the current 
user does not have permission to write to it


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

Branch: refs/heads/master
Commit: 103d40efac82b1bfd7a6cedf6db2db94031ffaf8
Parents: b3bdc27
Author: Patrick Wong <pw...@maprtech.com>
Authored: Mon Nov 17 15:16:10 2014 -0800
Committer: Parth Chandra <pchan...@maprtech.com>
Committed: Wed Mar 11 21:13:17 2015 -0700

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


http://git-wip-us.apache.org/repos/asf/drill/blob/103d40ef/distribution/src/resources/drill-config.sh
----------------------------------------------------------------------
diff --git a/distribution/src/resources/drill-config.sh 
b/distribution/src/resources/drill-config.sh
index 210c246..0ee181d 100644
--- a/distribution/src/resources/drill-config.sh
+++ b/distribution/src/resources/drill-config.sh
@@ -80,10 +80,19 @@ fi
 # 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
 fi
 
-if [ ! -d $DRILL_LOG_DIR ]; then
-  echo "Drill log directory $DRILL_LOG_DIR does not exist, defaulting to 
$DRILL_HOME/log"
+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
 fi

Reply via email to