nosqlbench/nb-engine/nb-engine-cli/bin/run-eb

63 lines
1.6 KiB
Plaintext
Raw Permalink Normal View History

2020-02-20 15:37:57 -06:00
#!/bin/bash
export AUTO_INSTALL=${AUTO_INSTALL:-"true"}
export FORCE_INSTALL=${FORCE_INSTALL:-"false"}
export FETCH_ONLY=${FETCH_ONLY:-"false"}
export STALE_DAYS=${STALE_DAYS:-"2"}
if ! which curl >> /dev/null 2>&1
then
printf "$0 requires curl to be in the path.\n";
exit 2
fi
export NB_JARNAME="nb.jar"
DOINSTALL="false"
if [ ! -f "${NB_JARNAME}" -a "${AUTO_INSTALL}" = "true" ]
then DOINSTALL="true"
elif [ "${FORCE_INSTALL}" = "true" ]
then DOINSTALL="true"
elif find ${NB_JARNAME} -mtime ${STALE_DAYS} | grep ${NB_JARNAME}
# 2>&1 >>/dev/null
then
DOINSTALL="true"
printf "forcing download because the jar is more than %s days old\n" ${STALE_DAYS}
fi
if [ "${DOINSTALL}" = "true" ]
then
export central_runtime_version=$(
curl -s -L \
'http://search.maven.org/solrsearch/select?q=g:"io
2020-02-24 10:20:00 -06:00
.nosqlbench"%20AND%20a:"engine-cli"%20AND%20p:"jar"&wt=json&rows=1' \
2020-02-20 15:37:57 -06:00
| perl -pe 'if (/"latestVersion":"([\d\.]+?)"/) { $_ = $1 } else {$_="nope"}'
)
2020-04-20 02:02:39 -05:00
export DOWNLOAD_VERSION=${central_runtime_version:?"Unable to find a downloadable version via maven central search."}
2020-02-20 15:37:57 -06:00
printf 'Downloading version: %s\n...' ${DOWNLOAD_VERSION} 1>&2
export DOWNLOAD_URL="https://repo1.maven
2020-02-24 10:20:00 -06:00
.org/maven2/io/nosqlbench/engine-cli/${DOWNLOAD_VERSION}/engine-cli-$
2020-02-20 15:37:57 -06:00
{DOWNLOAD_VERSION}.jar"
printf 'Download URL: %s\n' ${DOWNLOAD_URL}
printf 'fetching nosqlbench CLI from %s...\n' "${DOWNLOAD_URL}" 1>&2
(
cd /tmp ;
curl -s -L -o 'nb.jar' "${DOWNLOAD_URL}"
)
mv /tmp/nb.jar ${NB_JARNAME}
printf "The NB jar has been saved as %s\n" ${NB_JARNAME}
fi
if [ "${FETCH_ONLY}" = "true" ]
then
printf "fetching client only, exiting\n" 1>&2
exit 0;
fi;
java -jar ${NB_JARNAME} \
$*