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

# This command starts the external data manager program into execution
# for particulate data for Cummins sites.
#
# Usage: start_particulate_load configuration_file
#
# Author: Rob Janes
# 
# History
#   04/16/18 - Rob Janes - Initial release.

FILE=/specs/extdatman.cummins.particulate

# 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_particulate_load $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/particulate_loading.`date +"%y%m%d"` 2>&1 &
