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

#
# Script name: stop_cummins_transfers
# 
# Purpose: 
#    Gracefully terminate the cummins transfer processing.
# 
# Invoking arguments:
#   None
#
# Notes:
#    None
#
# History
#   02/20/2014 - Rob Janes - Initial release
#

PROG=com.cybermetrix.cyflex.applications.cummins_transfers.external_file_transfer
FILE=/specs/cummins_transfer_config.txt
# Find the PID for the cummins data loading process.
PID=$(ps -ef | grep $PROG | grep $FILE | grep -v grep | tr -s ' ' | cut -f2 -d\ )
# If cummins file transfer isn't running, no need to stop it.
if [ "$PID" = "" ]; then 
   exit 0  
fi

# File the stop file name.
STOP_FILE=`grep cyflex.extdatman.stopFile $FILE | cut -f2 -d\  `

# Invoke the common stopping script.
stop_loading $PID $STOP_FILE 60 5
