| 6 | 
 #  MITgcm/verificaton/testreport script and store the data in a | 
 #  MITgcm/verificaton/testreport script and store the data in a | 
| 7 | 
 #  reasonable location. | 
 #  reasonable location. | 
| 8 | 
  | 
  | 
 | 
  | 
  | 
| 9 | 
 usage() | 
 usage() | 
| 10 | 
 { | 
 { | 
| 11 | 
     echo | 
     echo | 
| 42 | 
 MUNPACK=$HERE/munpack | 
 MUNPACK=$HERE/munpack | 
| 43 | 
 UnpTmpD="/var/tmp/m-prts-$USER" | 
 UnpTmpD="/var/tmp/m-prts-$USER" | 
| 44 | 
 TR_LIST='TTT.'$$ | 
 TR_LIST='TTT.'$$ | 
| 45 | 
 TEMPDIR=/tmp/prc_emails | 
 TEMPDIR="/tmp/prc_emails_$USER" | 
| 46 | 
 STDOUT=$TEMPDIR/'outp.'$$ | 
 STDOUT=$TEMPDIR/'outp.'$$ | 
| 47 | 
 ERRMSG=/tmp/tmp.$$ | 
 ERRMSG=/tmp/tmp.$$ | 
| 48 | 
 PRT=1 | 
 PRT=1 | 
| 130 | 
 fi | 
 fi | 
| 131 | 
  | 
  | 
| 132 | 
 #---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| | 
 #---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| | 
| 133 | 
  | 
 #- 0) check that $TEMPDIR exist (needed for STDOUT) | 
| 134 | 
  | 
 if test ! -d $TEMPDIR ; then | 
| 135 | 
  | 
     mkdir $TEMPDIR | 
| 136 | 
  | 
     RETVAL=$? | 
| 137 | 
  | 
     if test "x$RETVAL" != x0 ; then | 
| 138 | 
  | 
         date | 
| 139 | 
  | 
         echo "ERROR: directory \"$TEMPDIR\" doesn't exist and can't be created" | 
| 140 | 
  | 
         exit 4 | 
| 141 | 
  | 
     fi | 
| 142 | 
  | 
 fi | 
| 143 | 
  | 
  | 
| 144 | 
 #- 1) check that $INDIR is empty | 
 #- 1) check that $INDIR is empty | 
| 145 | 
 nbMsg=`ls -1 $INDIR | wc -l` | 
 nbMsg=`ls -1 $INDIR | wc -l` | 
| 146 | 
 if test $nbMsg != 0 ; then | 
 if test $nbMsg != 0 ; then | 
| 147 | 
     date | 
     date | 
| 148 | 
     echo "ERROR: '$INDIR' is not empty ! --> exit" | 
     echo "ERROR: '$INDIR' is not empty ! --> exit" | 
| 149 | 
     exit 4 | 
     exit 5 | 
| 150 | 
 fi | 
 fi | 
| 151 | 
  | 
  | 
| 152 | 
 nbMsg=0; ORIG=${RHOST}:$M_DIR | 
 nbMsg=0; ORIG=${RHOST}:$M_DIR | 
| 162 | 
         date | 
         date | 
| 163 | 
         cat $STDOUT | 
         cat $STDOUT | 
| 164 | 
         echo "ERROR: when trying to scp msg from $ORIG to $INDIR" | 
         echo "ERROR: when trying to scp msg from $ORIG to $INDIR" | 
| 165 | 
         rm -f $STDOUT | 
        #rm -f $STDOUT | 
| 166 | 
         exit 5 | 
         exit 6 | 
| 167 | 
     fi | 
     fi | 
 | 
     rm -f $STDOUT | 
  | 
| 168 | 
     nbMsg=`ls -1 | wc -l` | 
     nbMsg=`ls -1 | wc -l` | 
| 169 | 
     if test $nbMsg != 0 ; then | 
     if test $nbMsg != 0 ; then | 
| 170 | 
         echo "> scp $nbMsg msg from '$ORIG' to '$INDIR'" | 
         echo "> scp $nbMsg msg from '$ORIG' to '$INDIR'" | 
| 171 | 
         listMsg=`ls -1` | 
         listMsg=`ls -1` | 
| 172 | 
     fi | 
     fi | 
| 173 | 
  | 
    #rm -f $STDOUT | 
| 174 | 
 cd $HERE | 
 cd $HERE | 
| 175 | 
 #echo " nbMsg='$nbMsg' ; listMsg='$listMsg'" | 
 #echo " nbMsg='$nbMsg' ; listMsg='$listMsg'" | 
| 176 | 
  | 
  | 
| 181 | 
     RETVAL=$? | 
     RETVAL=$? | 
| 182 | 
     if test "x$RETVAL" != x0 ; then | 
     if test "x$RETVAL" != x0 ; then | 
| 183 | 
         echo "ERROR ( $RETVAL ) when trying to ssh+rm $nbMsg msg from $ORIG" | 
         echo "ERROR ( $RETVAL ) when trying to ssh+rm $nbMsg msg from $ORIG" | 
| 184 | 
     #- note: Checking for return-value fron ssh command is not good enough, | 
     #- note: Checking for return-value from ssh command is not good enough, | 
| 185 | 
     #        therefore we do not terminate if non-zero | 
     #        therefore we do not terminate if non-zero | 
| 186 | 
        #exit 6 | 
       # exit 7 | 
| 187 | 
     fi | 
     fi | 
| 188 | 
  | 
 #- This is the log file that "check_outp" (run on baudelaire) was checking: | 
| 189 | 
  | 
   # logpfx="prc_emails_" ; sfx=`date +%m%d` | 
| 190 | 
  | 
   # logfile="/net/zany/data/ORWELL/export-7/u/jmc/testing/logs/${logpfx}$sfx" | 
| 191 | 
  | 
 #- update log-file to trigger a new "check_outp": | 
| 192 | 
  | 
   # if test -e  $logfile ; then touch $logfile ; fi | 
| 193 | 
 fi | 
 fi | 
| 194 | 
 #echo 'Start processing msg locally' | 
 #echo 'Start processing msg locally' | 
| 195 | 
 #exit | 
 #exit |