From e15c6d3d486f967a28d9b805fa1092df6bd57ef3 Mon Sep 17 00:00:00 2001 From: emiling Date: Thu, 10 Sep 2020 19:49:47 +0900 Subject: [PATCH] Add checking if hbase table was created before --- pinpoint-hbase/build/scripts/check-table.sh | 11 +++++++++++ pinpoint-hbase/build/scripts/initialize-hbase.sh | 5 +++++ 2 files changed, 16 insertions(+) create mode 100644 pinpoint-hbase/build/scripts/check-table.sh create mode 100644 pinpoint-hbase/build/scripts/initialize-hbase.sh diff --git a/pinpoint-hbase/build/scripts/check-table.sh b/pinpoint-hbase/build/scripts/check-table.sh new file mode 100644 index 0000000..667a302 --- /dev/null +++ b/pinpoint-hbase/build/scripts/check-table.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +if echo -e "exists 'AgentInfo'" | ${HBASE_HOME}/bin/hbase shell 2>&1 | grep -q "does exist" 2>/dev/null +then + echo "Tables already exist" + break +else + sleep 15 + echo "create tables" + ${HBASE_HOME}/bin/hbase shell ${BASE_DIR}/hbase-create.hbase +fi \ No newline at end of file diff --git a/pinpoint-hbase/build/scripts/initialize-hbase.sh b/pinpoint-hbase/build/scripts/initialize-hbase.sh new file mode 100644 index 0000000..ca72ffd --- /dev/null +++ b/pinpoint-hbase/build/scripts/initialize-hbase.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +${HBASE_HOME}/bin/start-hbase.sh + +/usr/local/bin/check-table.sh \ No newline at end of file