/[MITgcm]/mitgcm.org/front_content/parse_emails
ViewVC logotype

Diff of /mitgcm.org/front_content/parse_emails

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

--- mitgcm.org/front_content/parse_emails	2008/02/26 21:34:00	1.14
+++ mitgcm.org/front_content/parse_emails	2008/02/28 20:03:45	1.15
@@ -1,6 +1,6 @@
 #! /usr/bin/env bash
 
-# $Header: /home/ubuntu/mnt/e9_copy/mitgcm.org/front_content/parse_emails,v 1.14 2008/02/26 21:34:00 jmc Exp $
+# $Header: /home/ubuntu/mnt/e9_copy/mitgcm.org/front_content/parse_emails,v 1.15 2008/02/28 20:03:45 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
@@ -102,7 +102,7 @@
 if test ! -e $OUTDIR ; then
     mkdir $OUTDIR
     RETVAL=$?
-    if test "x$RETVAL" = x ; then
+    if test "x$RETVAL" != x0 ; then
 	echo "ERROR: directory \"$OUTDIR\" doesn't exist and can't be created"
 	exit 3
     fi
@@ -130,7 +130,23 @@
     #  create local copy
     test -e $TEMPDIR  &&  rm -rf $TEMPDIR
     mkdir $TEMPDIR
-    cp $INDIR"/"$file $TEMPDIR
+    RETVAL=$?
+    if test "x$RETVAL" = x0 ; then
+      cp $INDIR"/"$file $TEMPDIR
+      RETVAL=$?
+    fi
+    if test "x$RETVAL" != x0 ; then
+      if test "x$ADDRERR" != x ; then
+        echo "parsing email error" > tmp.$$
+        echo " processing file: '$INDIR/$file'" >> tmp.$$
+        echo -n "'mkdir $TEMPDIR' or 'cp $INDIR/$file $TEMPDIR'" >> tmp.$$
+        echo " returns error $RETVAL" >> tmp.$$
+        mail -s 'parse_emails err_0' $ADDRERR < tmp.$$
+        rm -f tmp.$$
+      fi
+      mv -f $INDIR"/"$file $INDIR"/../fail2process/"$file
+      continue
+    fi
 
     #  ignore multi-part messages
     grep "Content-Type: message/partial" $INDIR"/"$file > /dev/null 2>&1
@@ -191,6 +207,19 @@
     fi
     if test $PRT = 2 ; then echo -n " '$sdir'" ; fi
     mv $TEMPDIR"/"$tdir $OUTDIR"/"$sdir > /dev/null 2>&1
+    RETVAL=$?
+    if test "x$RETVAL" != x0 ; then
+      if test "x$ADDRERR" != x ; then
+        echo "parsing email error" > tmp.$$
+        echo "mv $TEMPDIR/$tdir $OUTDIR/$sdir returns error:" $RETVAL >> tmp.$$
+        echo -n "in dir: $TEMPDIR : " ; ls -l $TEMPDIR  >> tmp.$$
+        echo -n "in dir: $OUTDIR : " ; ls -l $OUTDIR  >> tmp.$$
+        mail -s 'parse_emails err_4' $ADDRERR < tmp.$$
+        rm -f tmp.$$
+      fi
+      mv -f $INDIR"/"$file $INDIR"/../fail2process/"$file
+      continue
+    fi
     chmod -R a+rx $OUTDIR"/"$sdir > /dev/null 2>&1
 #   gzip $OUTDIR"/"$sdir"/output.txt"
 

 

  ViewVC Help
Powered by ViewVC 1.1.22