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:"
|
|
|
|
echo `ls ${EXAMPLES_DIR}`
|
|
|
|
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`
|
|
|
|
DRUID_CP=${DRUID_CP}:${SCRIPT_DIR}/../config
|
2013-05-05 00:02:31 -04:00
|
|
|
#For the kit
|
2013-06-10 14:53:57 -04:00
|
|
|
DRUID_CP=${DRUID_CP}:`ls ${SCRIPT_DIR}/lib/druid-examples-*-selfcontained.jar`
|
|
|
|
DRUID_CP=${DRUID_CP}:${SCRIPT_DIR}/config
|
2013-05-01 13:51:26 -04:00
|
|
|
|
|
|
|
echo "Running command:"
|
|
|
|
|
|
|
|
(set -x; java ${JAVA_ARGS} -classpath ${DRUID_CP} druid.examples.RealtimeStandaloneMain)
|