/[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

revision 1.14 by jmc, Tue Feb 26 21:34:00 2008 UTC revision 1.18 by jmc, Thu Sep 18 20:13:36 2008 UTC
# Line 87  for ac_option ; do Line 87  for ac_option ; do
87    
88          *)          *)
89              # copy the file list to FL_#              # copy the file list to FL_#
90                date
91              echo "Error: don't understand argument \"$ac_option\""              echo "Error: don't understand argument \"$ac_option\""
92              usage              usage
93              ;;              ;;
# Line 96  for ac_option ; do Line 97  for ac_option ; do
97  done  done
98    
99  if test ! -x $MUNPACK ; then  if test ! -x $MUNPACK ; then
100            date
101          echo "ERROR: \"$MUNPACK\" is not executable"          echo "ERROR: \"$MUNPACK\" is not executable"
102          exit 2          exit 2
103  fi  fi
104  if test ! -e $OUTDIR ; then  if test ! -e $OUTDIR ; then
105      mkdir $OUTDIR      mkdir $OUTDIR
106      RETVAL=$?      RETVAL=$?
107      if test "x$RETVAL" = x ; then      if test "x$RETVAL" != x0 ; then
108            date
109          echo "ERROR: directory \"$OUTDIR\" doesn't exist and can't be created"          echo "ERROR: directory \"$OUTDIR\" doesn't exist and can't be created"
110          exit 3          exit 3
111      fi      fi
# Line 118  if test $PRT = 1 ; then Line 121  if test $PRT = 1 ; then
121    echo "Using INDIR=\"$INDIR\""    echo "Using INDIR=\"$INDIR\""
122    echo -n "Unpacking the emails ..."    echo -n "Unpacking the emails ..."
123  elif test $nb_files != 0 ; then  elif test $nb_files != 0 ; then
124    echo "Unpacking $nb_files emails from '$INDIR' to '$OUTDIR'"    echo -n "Unpacking $nb_files emails ("`date`
125    if test "x$ADDRERR" != x ; then    if test "x$ADDRERR" != x ; then
126       echo " (send msg to '$ADDRERR' if Error)"       echo -n ", err-msg: '$ADDRERR'"
127    fi    fi
128    if test $PRT = 2 ; then echo -n " dir:" ; fi    echo ")"
129      echo " from '$INDIR' to '$OUTDIR'"
130  fi  fi
131    
132  for file in $all_files ; do  for file in $all_files ; do
# Line 130  for file in $all_files ; do Line 134  for file in $all_files ; do
134      #  create local copy      #  create local copy
135      test -e $TEMPDIR  &&  rm -rf $TEMPDIR      test -e $TEMPDIR  &&  rm -rf $TEMPDIR
136      mkdir $TEMPDIR      mkdir $TEMPDIR
137      cp $INDIR"/"$file $TEMPDIR      RETVAL=$?
138        if test "x$RETVAL" = x0 ; then
139          cp $INDIR"/"$file $TEMPDIR
140          RETVAL=$?
141        fi
142        if test "x$RETVAL" != x0 ; then
143          if test "x$ADDRERR" != x ; then
144            echo "parsing email error" > tmp.$$
145            echo " processing file: '$INDIR/$file'" >> tmp.$$
146            echo -n "'mkdir $TEMPDIR' or 'cp $INDIR/$file $TEMPDIR'" >> tmp.$$
147            echo " returns error $RETVAL" >> tmp.$$
148            mail -s 'parse_emails err_0' $ADDRERR < tmp.$$
149            rm -f tmp.$$
150          fi
151          mv -f $INDIR"/"$file $INDIR"/../fail2process/"$file
152          continue
153        fi
154    
155      #  ignore multi-part messages      #  ignore multi-part messages
156      grep "Content-Type: message/partial" $INDIR"/"$file > /dev/null 2>&1      grep "Content-Type: message/partial" $INDIR"/"$file > /dev/null 2>&1
# Line 189  for file in $all_files ; do Line 209  for file in $all_files ; do
209          done          done
210          sdir=$tdir"_"$ad          sdir=$tdir"_"$ad
211      fi      fi
212      if test $PRT = 2 ; then echo -n " '$sdir'" ; fi      if test $PRT = 2 ; then echo " '$sdir'" ; fi
213      mv $TEMPDIR"/"$tdir $OUTDIR"/"$sdir > /dev/null 2>&1      mv $TEMPDIR"/"$tdir $OUTDIR"/"$sdir > /dev/null 2>&1
214        RETVAL=$?
215        if test "x$RETVAL" != x0 ; then
216          if test "x$ADDRERR" != x ; then
217            echo "parsing email error" > tmp.$$
218            echo "mv $TEMPDIR/$tdir $OUTDIR/$sdir returns error:" $RETVAL >> tmp.$$
219            echo -n "in dir: $TEMPDIR : " ; ls -l $TEMPDIR  >> tmp.$$
220            echo -n "in dir: $OUTDIR : " ; ls -l $OUTDIR  >> tmp.$$
221            mail -s 'parse_emails err_4' $ADDRERR < tmp.$$
222            rm -f tmp.$$
223          fi
224          mv -f $INDIR"/"$file $INDIR"/../fail2process/"$file
225          continue
226        fi
227      chmod -R a+rx $OUTDIR"/"$sdir > /dev/null 2>&1      chmod -R a+rx $OUTDIR"/"$sdir > /dev/null 2>&1
228  #   gzip $OUTDIR"/"$sdir"/output.txt"  #   gzip $OUTDIR"/"$sdir"/output.txt"
229    
# Line 199  for file in $all_files ; do Line 232  for file in $all_files ; do
232    
233  done  done
234  if test $PRT = 1 ; then echo "  done" ; fi  if test $PRT = 1 ; then echo "  done" ; fi
 if test $PRT = 2 -a $nb_files != 0 ; then echo "" ; fi  
235    

Legend:
Removed from v.1.14  
changed lines
  Added in v.1.18

  ViewVC Help
Powered by ViewVC 1.1.22