2013-05-01 13:51:26 -04:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
echo "This will run a stand-alone version of Druid"
|
|
|
|
set +u
|
|
|
|
shopt -s xpg_echo
|
|
|
|
shopt -s expand_aliases
|
|
|
|
trap "exit 1" 1 2 3 15
|
|
|
|
|
|
|
|
SCRIPT_DIR=`dirname $0`
|
|
|
|
CURR_DIR=`pwd`
|
|
|
|
cd ${SCRIPT_DIR}
|
|
|
|
SCRIPT_DIR=`pwd`
|
|
|
|
cd ${CURR_DIR}
|
|
|
|
|
|
|
|
EXAMPLES_DIR=${SCRIPT_DIR}/examples
|
|
|
|
|
|
|
|
[ -d /tmp/example ] && echo "Cleaning up from previous run.." && /bin/rm -fr /tmp/example
|
|
|
|
|
|
|
|
EXAMPLE=$1
|
|
|
|
if [ -z ${EXAMPLE} ] ; then
|
|
|
|
echo "Please specify an example type."
|
|
|
|
echo "Examples availables:"
|
2013-11-07 18:42:48 -05:00
|
|
|
echo `ls ${EXAMPLES_DIR} | grep -v indexing`
|
2013-05-01 13:51:26 -04:00
|
|
|
read -p "> " EXAMPLE
|
|
|
|
echo " "
|
|
|
|
fi
|
|
|
|
|
|
|
|
EXAMPLE_LOC=${EXAMPLES_DIR}/${EXAMPLE}
|
|
|
|
|
|
|
|
while [[ ! -e ${EXAMPLE_LOC} ]] ; do
|
|
|
|
echo "Unknown example ${EXAMPLE}, please specify a known example."
|
|
|
|
echo "Known examples:"
|
|
|
|
echo `ls ${EXAMPLES_DIR}`
|
|
|
|
read -p "> " EXAMPLE
|
|
|
|
EXAMPLE_LOC=${EXAMPLES_DIR}/${EXAMPLE}
|
|
|
|
echo " "
|
|
|
|
done
|
|
|
|
|
|
|
|
SPEC_FILE=${EXAMPLE_LOC}/${EXAMPLE}_realtime.spec
|
|
|
|
|
|
|
|
# check spec file exists
|
|
|
|
[ ! -e ${SPEC_FILE} ] && echo "Expecting file ${SPEC_FILE} to exist, it didn't" && exit 3
|
|
|
|
|
|
|
|
# run before script if it exists
|
|
|
|
if [ -e ${EXAMPLE_LOC}/before.sh ]; then
|
|
|
|
trap "set +x; cd ${EXAMPLE_LOC} && ./after.sh && cd ${CURR_DIR}; exit 1" EXIT
|
|
|
|
cd ${EXAMPLE_LOC}
|
|
|
|
./before.sh
|
|
|
|
cd ${CURR_DIR}
|
|
|
|
fi
|
|
|
|
|
|
|
|
# start process
|
|
|
|
JAVA_ARGS="-Xmx256m -Duser.timezone=UTC -Dfile.encoding=UTF-8"
|
|
|
|
JAVA_ARGS="${JAVA_ARGS} -Ddruid.realtime.specFile=${SPEC_FILE}"
|
|
|
|
|
2013-05-05 00:02:31 -04:00
|
|
|
|
2013-05-01 13:51:26 -04:00
|
|
|
DRUID_CP=${EXAMPLE_LOC}
|
2013-05-05 00:02:31 -04:00
|
|
|
#For a pull
|
2013-06-10 14:53:57 -04:00
|
|
|
DRUID_CP=${DRUID_CP}:`ls ${SCRIPT_DIR}/../target/druid-examples-*-selfcontained.jar`
|
2013-11-12 18:30:59 -05:00
|
|
|
DRUID_CP=${DRUID_CP}:`ls ${SCRIPT_DIR}/../../services/target/druid-services-*-selfcontained.jar`
|
2013-08-22 22:48:21 -04:00
|
|
|
DRUID_CP=${DRUID_CP}:${SCRIPT_DIR}/../config/realtime
|
2013-05-05 00:02:31 -04:00
|
|
|
#For the kit
|
2013-09-04 15:53:38 -04:00
|
|
|
DRUID_CP=${DRUID_CP}:${SCRIPT_DIR}/lib/*
|
2013-08-22 22:48:21 -04:00
|
|
|
DRUID_CP=${DRUID_CP}:${SCRIPT_DIR}/config/realtime
|
2013-05-01 13:51:26 -04:00
|
|
|
|
|
|
|
echo "Running command:"
|
|
|
|
|
2013-10-02 17:22:39 -04:00
|
|
|
(set -x; java ${JAVA_ARGS} -classpath ${DRUID_CP} io.druid.cli.Main example realtime)
|