--- mitgcm.org/front_content/get+parse_msg 2018/01/06 20:51:40 1.2 +++ mitgcm.org/front_content/get+parse_msg 2018/01/12 15:51:10 1.4 @@ -1,6 +1,6 @@ #! /usr/bin/env bash -# $Header: /home/ubuntu/mnt/e9_copy/mitgcm.org/front_content/get+parse_msg,v 1.2 2018/01/06 20:51:40 jmc Exp $ +# $Header: /home/ubuntu/mnt/e9_copy/mitgcm.org/front_content/get+parse_msg,v 1.4 2018/01/12 15:51:10 jmc Exp $ # # The purpose of this script is to parse the emails produced by the # MITgcm/verificaton/testreport script and store the data in a @@ -42,7 +42,7 @@ MUNPACK=$HERE/munpack UnpTmpD="/var/tmp/m-prts-$USER" TR_LIST='TTT.'$$ -TEMPDIR=/tmp/prc_emails +TEMPDIR="/tmp/prc_emails_$USER" STDOUT=$TEMPDIR/'outp.'$$ ERRMSG=/tmp/tmp.$$ PRT=1 @@ -130,12 +130,23 @@ fi #---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| +#- 0) check that $TEMPDIR exist (needed for STDOUT) +if test ! -d $TEMPDIR ; then + mkdir $TEMPDIR + RETVAL=$? + if test "x$RETVAL" != x0 ; then + date + echo "ERROR: directory \"$TEMPDIR\" doesn't exist and can't be created" + exit 4 + fi +fi + #- 1) check that $INDIR is empty nbMsg=`ls -1 $INDIR | wc -l` if test $nbMsg != 0 ; then date echo "ERROR: '$INDIR' is not empty ! --> exit" - exit 4 + exit 5 fi nbMsg=0; ORIG=${RHOST}:$M_DIR @@ -151,15 +162,15 @@ date cat $STDOUT echo "ERROR: when trying to scp msg from $ORIG to $INDIR" - rm -f $STDOUT - exit 5 + #rm -f $STDOUT + exit 6 fi - rm -f $STDOUT nbMsg=`ls -1 | wc -l` if test $nbMsg != 0 ; then echo "> scp $nbMsg msg from '$ORIG' to '$INDIR'" listMsg=`ls -1` fi + #rm -f $STDOUT cd $HERE #echo " nbMsg='$nbMsg' ; listMsg='$listMsg'" @@ -170,15 +181,15 @@ RETVAL=$? if test "x$RETVAL" != x0 ; then echo "ERROR ( $RETVAL ) when trying to ssh+rm $nbMsg msg from $ORIG" - #- note: Checking for return-value fron ssh command is not good enough, + #- note: Checking for return-value from ssh command is not good enough, # therefore we do not terminate if non-zero - #exit 6 + # exit 7 fi #- This is the log file that current "check_outp" (run on baudelaire) is checking: - logpfx="prc_emails_" ; sfx=`date +%m%d` - logfile="/net/zany/data/ORWELL/export-7/u/jmc/testing/logs/${logpfx}$sfx" + logpfx="prc_emails_" ; sfx=`date +%m%d` + logfile="/net/zany/data/ORWELL/export-7/u/jmc/testing/logs/${logpfx}$sfx" #- update log-file to trigger a new "check_outp": - if test -e $logfile ; then touch $logfile ; fi + if test -e $logfile ; then touch $logfile ; fi fi #echo 'Start processing msg locally' #exit