#!/bin/sh

BUILD_FOLDER="bin"
MAIN_CLASS="cz.senslog.connector.app.Main" 
LOG_PATH="/var/log/connector-app"
DEBUG_PORT="5005"

FILEBEAT_CONFIG_FILE="/etc/conf.d/filebeat.yml"

if [ $DEBUG = "true" ]; then
    DEBUG_PARAM="-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=0.0.0.0:$DEBUG_PORT"
fi

if [ $LOG_MONITOR = "true" ]; then
    filebeat  -c $FILEBEAT_CONFIG_FILE & 
fi

java -cp "$BUILD_FOLDER/*" -DlogPath=$LOG_PATH $DEBUG_PARAM $MAIN_CLASS $APP_PARAMS
