awips2/nativeLib/ohd.sshp/scripts/process_hydro_model_data
root e2ecdcfe33 Initial revision of AWIPS2 11.9.0-7p5
Former-commit-id: a02aeb236c [formerly 9f19e3f712] [formerly a02aeb236c [formerly 9f19e3f712] [formerly 06a8b51d6d [formerly 64fa9254b946eae7e61bbc3f513b7c3696c4f54f]]]
Former-commit-id: 06a8b51d6d
Former-commit-id: 8e80217e59 [formerly 3360eb6c5f]
Former-commit-id: 377dcd10b9
2012-01-06 08:55:05 -06:00

51 lines
No EOL
1.3 KiB
Bash

#!/bin/ksh
# file name: process_hydro_model_data
# Created: 04/01/2004
# This allows you to run this script from outside of ./bin
RUN_FROM_DIR=`dirname $0`
# set up SOME environment variables for WHFS applications
. $RUN_FROM_DIR/../../set_hydro_env
# setup the AWIPS environment
#
. $FXA_HOME/readenv.sh
FILENAME=$1
SUBJECT=$2
MSGTYPE=$3
# use a shell function to extract the argument from the subject line
# the subject string is a quoted string with the a descriptive term,
# followed by a space, followed by the product identifier.
#
parseSubject()
{
ORIGINAL_FILE_NAME=$1
PRODUCTID=$2
return
}
#
# get the product id from the subject
#
parseSubject $SUBJECT
ORIGINAL_FILE_PATH=$SSHP_INCOMING_DIR/$ORIGINAL_FILE_NAME
# Keeps the last 1200 lines of the log file
LOGFILE=$SSHP_LOG_DIR/process_hydro_model_data.log
TMPFILE=$SSHP_LOG_DIR/process_hydro_model_data.tmp
tail -1200 $LOGFILE > $TMPFILE
mv $TMPFILE $LOGFILE
cp -f $FILENAME $ORIGINAL_FILE_PATH
# used to remove the header and ^Ms from the transferred XML file
sed '1,2d' $ORIGINAL_FILE_PATH > $SSHP_INCOMING_DIR/temp.xml
cat $SSHP_INCOMING_DIR/temp.xml | tr -d '\015' > $ORIGINAL_FILE_PATH
rm -f $SSHP_INCOMING_DIR/temp.xml
ssh -oBatchMode=yes $SSHP_JAVA_PROCESS_HOST $WHFS_BIN_DIR/run_SSHP_data_decode >$LOGFILE 2>>$LOGFILE