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

# This command starts the external data manager program into execution
# for abatement calibration data for Cummins sites.
#
# Usage: start_abate_cal_loading configuration_file
#
# Author: Andrew Anker
# 
# History
#   11/16/16 - Andrew Anker - Initial release.

# This requires 1 command line argument, an existing configuration file.
if (( $# != 1 )); then
   echo This program requires one command line argument, the spec file.
   exit 1
fi
if [ ! -e $1 ]; then
   echo The command line argument must be an existing file.
   exit 1
fi

. configure_java

# kill current version (if any)
stop_abate_cal_loading $1

# Set up class path for Java.
BASE=$GUI
export CLASSPATH=$BASE/ExternalDataManager.jar:$BASE/specfilegui.jar:$D3/ojdbc.jar

# Actually execute the program.
java -DPropertiesFile=$1 \
   com.cybermetrix.cyflex.extdatman.AbatementExtDatMan >> /data/errors/abate_cal_extdatman.`date +"%y%m%d"` 2>&1 &
