#!/bin/bash

SCRIPT_PATH=$BASH_SOURCE

SCRIPT_DIR=`dirname ${SCRIPT_PATH}`

CONFIG_FILE_DIR=${SCRIPT_DIR}/conf

mkdir -p "${CONFIG_FILE_DIR}"

CONFIG_CLASSPATH=.:${CONFIG_FILE_DIR}

LIB_DIR=${SCRIPT_DIR}/lib

#
#Set up our classpath with our library dependencies...
for jar in $(find "${LIB_DIR}"/*.jar);
do
    CONFIG_CLASSPATH=${jar}:${CONFIG_CLASSPATH}
done

#
#Guess JAVA_HOME if it's not set
if [ ${#JAVA_HOME} == 0 ]; then
    JAVA_HOME=/usr/local/java
fi

JVM_ARGS="-Xmx1024m"

JAVA_COMMAND="java ${JVM_ARGS} -cp ${CONFIG_CLASSPATH} net.shrine.hub.metrics.NetworkMetrics $@"

${JAVA_COMMAND}

