Files
impala/testdata/bin/run-mini-dfs.sh
Casey Ching cfb1ab5c2c IMPALA-2781: Fix shell error reporting after chdir
The original error reporting relied on $0 being accessible from the
current working dir, which failed if a script changed the working dir
and $0 was relative. This updates the error reporting command to cd back
to the original dir before accessing $0.

Change-Id: I2185af66e35e29b41dbe1bb08de24200bacea8a1
Reviewed-on: http://gerrit.cloudera.org:8080/1666
Reviewed-by: Casey Ching <casey@cloudera.com>
Tested-by: Internal Jenkins
2016-01-14 07:10:54 +00:00

25 lines
612 B
Bash
Executable File

#!/bin/bash
# Copyright (c) 2012 Cloudera, Inc. All rights reserved.
set -euo pipefail
trap 'echo Error in $0 at line $LINENO: $(cd "'$PWD'" && awk "NR == $LINENO" $0)' ERR
if [[ $# -eq 1 && "$1" == -format ]]; then
SHOULD_FORMAT=true
elif [[ $# -ne 0 ]]; then
echo "Usage: $0 [-format]"
echo "[-format] : Format the mini-dfs cluster before starting"
exit 1
else
SHOULD_FORMAT=false
fi
# Kill and clean data for a clean start.
$IMPALA_HOME/testdata/bin/kill-mini-dfs.sh
if $SHOULD_FORMAT; then
$IMPALA_HOME/testdata/cluster/admin delete_data
fi
$IMPALA_HOME/testdata/cluster/admin start_cluster