#! /bin/sh
#
# (ldds-vde) startup script...
#
#

# java setup...
JAVA_HOME="/level2/jre1.8.0_91/"
JAVA="${JAVA_HOME}/bin/java"

# check if there is an existing instance running...
PID=`ps auxwwwwwww | grep java | grep vde.json | awk '{ print $2 }'`
if [ ${PID}x != x ]
then
    echo "vde is already running (pid: ${PID})..."
    exit 0
fi

basedir="/level2/vde3.3.3/"

CLASSPATH=
CLASSPATH=${CLASSPATH}:${basedir}
CLASSPATH=${CLASSPATH}:${basedir}/lib/dom4j-1.6.1.jar
CLASSPATH=${CLASSPATH}:${basedir}/lib/ezsoft_step.jar
CLASSPATH=${CLASSPATH}:${basedir}/lib/hamcrest-core-1.3.jar
CLASSPATH=${CLASSPATH}:${basedir}/lib/json-20160212.jar
CLASSPATH=${CLASSPATH}:${basedir}/lib/ldds_pipe.jar
CLASSPATH=${CLASSPATH}:${basedir}/lib/log4j-1.2.12.jar
CLASSPATH=${CLASSPATH}:${basedir}/lib/openfast-1.1.2.jar
CLASSPATH=${CLASSPATH}:${basedir}/lib/ldds-vde.jar
CLASSPATH=${CLASSPATH}:${basedir}/conf


sysprops=
sysprops="${sysprops} -server"
sysprops="${sysprops} -Xms1024M -Xmx4096M "
# sysprops="${sysprops} -XX:NewRatio=2 -XX:+AggressiveHeap "
# sysprops="${sysprops} -XX:CompileThreshold=100"
# sysprops="${sysprops} -verbose:GC -XX:+PrintGCDetails -XX:+PrintGCTimeStamps"
sysprops="${sysprops} -Djava.net.preferIPv4Stack=true"


CMD="${JAVA} ${sysprops} -cp ${CLASSPATH} com.sseinfo.lddsidc.boot.Main ../conf/vde.json ../conf/log4j-vde.properties"
echo ${CMD}
${CMD}

