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

# This script starts the external data manager for FFR data loading.
#
# The main feature is that this insures that only one instance at a time
# is running.  If an instance is already running, it will be killed and
# a new instance started.
#
# If two instances are running at a time, it is possible to get
# database errors.  One instance could start loading a file, then the
# second instance also starts loading it.  The 1st instance successfully
# loads the file.  The 2nd instance gets an error because it is trying 
# to insert a database record where one already exists from the 1st
# instance.
#
# Usage: /cyflex/cmds/start_ffr_loading
#
# Author: Rob Janes
# 
# History
#   07/01/13 - Rob Janes - Initial release.

# If this is already running, terminate it.
stop_ffr_loading

# Start the external data manager up.
DATE=`date +"%y%m%d"`
exec extdatman.cummins.ffr >> /data/errors/extdatman.ffr.$DATE 2>>/data/errors/extdatman.ffr.errs.$DATE &
