ACCUMULO-2891 check for masters file before grep

Check that file exists
Before we try to open it
Be one with all things


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

Branch: refs/heads/ACCUMULO-378
Commit: 1b170e8e5b416720ff67df85adfd2c2eac3ffab5
Parents: d50bb3a
Author: Mike Drob <md...@cloudera.com>
Authored: Wed Jun 11 10:17:38 2014 -0400
Committer: Mike Drob <md...@cloudera.com>
Committed: Wed Jun 11 11:52:35 2014 -0400

----------------------------------------------------------------------
 bin/config.sh | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/1b170e8e/bin/config.sh
----------------------------------------------------------------------
diff --git a/bin/config.sh b/bin/config.sh
index 931ec8b..7663473 100755
--- a/bin/config.sh
+++ b/bin/config.sh
@@ -115,7 +115,11 @@ then
 fi
 export HADOOP_PREFIX
 
-MASTER1=$(egrep -v '(^#|^\s*$)' "$ACCUMULO_CONF_DIR/masters" | head -1)
+unset MASTER1
+if [[ -f "$ACCUMULO_CONF_DIR/masters" ]]; then
+  MASTER1=$(egrep -v '(^#|^\s*$)' "$ACCUMULO_CONF_DIR/masters" | head -1)
+fi
+
 if [ -z "${MONITOR}" ] ; then
   MONITOR=$MASTER1
   if [ -f "$ACCUMULO_CONF_DIR/monitor" ]; then

Reply via email to