101 lines
3.4 KiB
Text
101 lines
3.4 KiB
Text
|
#!/bin/ksh
|
||
|
#
|
||
|
###############################################################################
|
||
|
# FILENAME: process_rfc_bias
|
||
|
# DESCRIPTION: This script is invoked via the message handling service (MHS)
|
||
|
# mechanisms. It is called when a rfc bias message file
|
||
|
# from a RFC is received at the local WFO. This script copies
|
||
|
# this file to a local directory where it is then processed
|
||
|
# by the process_rfc_bias program.
|
||
|
#
|
||
|
# The MHS places the incoming file in the directory:
|
||
|
# /data/x400/mhs/msg/hydro
|
||
|
# This script copies this file to the directory:
|
||
|
# /awips/hydroapps/precip_proc/local/data/rfc_bias_input
|
||
|
#
|
||
|
#
|
||
|
# The arguments to this script are provided via the
|
||
|
# message handling system (MHS) and are translated
|
||
|
# from the MHS args %ENCLOSE(1) %SUBJECT %MSGTYPE
|
||
|
#
|
||
|
#
|
||
|
# USAGE: process_rfc_bias filename subject_string msgtype
|
||
|
#
|
||
|
# AUTHOR: Bryon Lawrence
|
||
|
# CREATION DATE: April 5, 2007
|
||
|
# ORGANIZATION: OHD-11/HSEB
|
||
|
# MACHINE/SHELL: Korn shell
|
||
|
# MODIFICATION HISTORY:
|
||
|
# DATE PROGRAMMER DESCRIPTION/REASON
|
||
|
# 4/5/2007 B. Lawrence Created.
|
||
|
################################################################################
|
||
|
#
|
||
|
|
||
|
# This allows this script to be run from outside of the bin directory
|
||
|
RUN_FROM_DIR=`dirname $0`
|
||
|
|
||
|
# Set up the WHFS runtime environment
|
||
|
export FXA_HOME=/awips/fxa
|
||
|
. $FXA_HOME/readenv.sh
|
||
|
. $RUN_FROM_DIR/../../set_hydro_env
|
||
|
|
||
|
export CLASSPATH=$DB_DRIVER_PATH:$PPROC_BIN/bias_trans.jar
|
||
|
|
||
|
# Prepare the log file.
|
||
|
process_bias_log=`date +$PROCESS_BIAS_LOG_DIR/process_rfc_bias_%m%d`
|
||
|
|
||
|
echo "--------------------------------------------------" >> $process_bias_log
|
||
|
echo "Starting process_rfc_bias as $LOGNAME at $(date -u +"%T %Z") on \
|
||
|
$(date -u +"%a %b %d %Y") on $HOSTNAME" >> $process_bias_log
|
||
|
|
||
|
FILENAME=$1
|
||
|
SUBJECT=$2
|
||
|
MSGTYPE=$3
|
||
|
|
||
|
echo "The filename supplied by the MHS: $FILENAME" >> $process_bias_log
|
||
|
echo "The subject line supplied by the MHS: $SUBJECT" >> $process_bias_log
|
||
|
echo "The type of message supplied by the MHS: $MSGTYPE" >> $process_bias_log
|
||
|
|
||
|
#
|
||
|
# Use a shell function to extract the argument from the subject line
|
||
|
# the subject string is a quoted string with a filename, followed
|
||
|
# by a space, followed by the product identifier.
|
||
|
parseSubject()
|
||
|
{
|
||
|
DESCRIP=$1
|
||
|
PRODUCTID=$2
|
||
|
return
|
||
|
}
|
||
|
|
||
|
#
|
||
|
# Create the destination filename and path.
|
||
|
parseSubject $SUBJECT
|
||
|
DATESTR=`date -u +%m%d`
|
||
|
TIMESTR=`date -u +%H%M%S`
|
||
|
DESTINATION_FILENAME=$RFC_BIAS_INPUT_DIR/$PRODUCTID.$DATESTR.$TIMESTR
|
||
|
|
||
|
#
|
||
|
# Copy the MHS rfc bias file to the rfc_bias_input directory
|
||
|
echo "Copying $FILENAME to $DESTINATION_FILENAME" >> $process_bias_log
|
||
|
cp -f $FILENAME $DESTINATION_FILENAME >> $process_bias_log 2>&1
|
||
|
|
||
|
if [[ $? -ne 0 ]]
|
||
|
then
|
||
|
echo "The copy of $FILENAME to $DESTINATION_FILENAME failed." >> \
|
||
|
$process_bias_log
|
||
|
exit 1
|
||
|
fi
|
||
|
|
||
|
#
|
||
|
# Start the process_rfc_bias.LX program
|
||
|
echo "Starting the bias message reading program" >> $process_bias_log
|
||
|
echo "${SYS_JAVA_DIR}/bin/java ohd.hseb.bias_trans/BiasMessageReader $JDBCURL $DESTINATION_FILENAME" >> $process_bias_log
|
||
|
|
||
|
${SYS_JAVA_DIR}/bin/java ohd.hseb.bias_trans/BiasMessageReader $JDBCURL \
|
||
|
$DESTINATION_FILENAME >> $process_bias_log 2>&1
|
||
|
#
|
||
|
# Remove the bias message file
|
||
|
rm -f $DESTINATION_FILENAME >> $process_bias_log 2>&1
|
||
|
|
||
|
exit 0
|