#! /bin/bash
cyflexlogevent -t generic -m 1 -m "script" -m "$0" 

# This command starts the external data manager program into execution
# for composite (raw emission) data for Cummins sites.
#
# Usage: start_composite_load configuration_file
#
# Author: Rob Janes
# 
# History
#
#   10/06/20 - dar - CCS-1846 - update for TRI (12)
#
#   04/16/18 - Rob Janes - Initial release.

FILE=/specs/extdatman.cummins.12composite

# Make sure that Java is in the environment.
test "$JAVA_HOME" = ""
if (($? == 0 )); then
   . ~/.bash_profile
fi

# Set up class path for Java.
BASE=/cyflex/specfilegui
export CLASSPATH=$BASE/ExternalDataManager.jar\
:$BASE/specfilegui.jar\
:/cyflex/specfilegui.3rdparty/ojdbc.jar\
:/cyflex/specfilegui.3rdparty/SocketServer.jar\
:/cyflex/specfilegui.3rdparty/hopper_utilities.jar

stop_composite_load12 $FILE

# Actually execute the program.
export JAVA_HOME=/cyflex/java_jdk
PATH=$JAVA_HOME/bin:$PATH
java -DPropertiesFile=$FILE \
   com.cybermetrix.cyflex.extdatman.ExternalDataManager >> /data/errors/composite_loading.`date +"%y%m%d"` 2>&1 &
