Skip to content

Commit

Permalink
DRILL-2446: Improvement in finding Drill log dir
Browse files Browse the repository at this point in the history
  • Loading branch information
pwong-mapr authored and jacques-n committed Mar 26, 2015
1 parent c07e16f commit ff3bab7
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions distribution/src/resources/drill-config.sh
Expand Up @@ -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
Expand Down

0 comments on commit ff3bab7

Please sign in to comment.