22 |
echo " [def=\"$OUTDIR\"]" |
echo " [def=\"$OUTDIR\"]" |
23 |
echo " (-t |-tempd )DIR use temporary directory DIR" |
echo " (-t |-tempd )DIR use temporary directory DIR" |
24 |
echo " [def=\"$TEMPDIR\"]" |
echo " [def=\"$TEMPDIR\"]" |
25 |
|
echo " (-u |-unpack )EXE use executable EXE to unpack e-mails" |
26 |
|
echo " [def=\"$MUNPACK\"]" |
27 |
echo " (-a |-addr )ADDR send e-mail to ADDR if Error" |
echo " (-a |-addr )ADDR send e-mail to ADDR if Error" |
28 |
echo " [def='"$ADDRERR"']" |
echo " [def='"$ADDRERR"']" |
29 |
echo |
echo |
34 |
INDIR="/u/u2/jmc/Mail/MITgcm-test" |
INDIR="/u/u2/jmc/Mail/MITgcm-test" |
35 |
OUTDIR="/u/u0/httpd/html/testing/results/"`date +%Y`"_"`date +%m` |
OUTDIR="/u/u0/httpd/html/testing/results/"`date +%Y`"_"`date +%m` |
36 |
TEMPDIR=./ptmp |
TEMPDIR=./ptmp |
37 |
MUNPACK=/u/u2/jmc/testing/tools_mpack/munpack |
MUNPACK=munpack |
38 |
ADDRERR= |
ADDRERR= |
39 |
PRT=1 |
PRT=1 |
40 |
|
|
74 |
ac_prev=TEMPDIR ;; |
ac_prev=TEMPDIR ;; |
75 |
--tempd=* | -tempd=* | --t=* | -t=*) |
--tempd=* | -tempd=* | --t=* | -t=*) |
76 |
TEMPDIR=$ac_optarg ;; |
TEMPDIR=$ac_optarg ;; |
77 |
-a | --aa | -addr | --addr) |
|
78 |
|
-u | --u | -unpack | --unpack) |
79 |
|
ac_prev=MUNPACK ;; |
80 |
|
-u=* | --u=* | -unpack=* | --unpack=*) |
81 |
|
MUNPACK=$ac_optarg ;; |
82 |
|
|
83 |
|
-a | --a | -addr | --addr) |
84 |
ac_prev=ADDRERR ;; |
ac_prev=ADDRERR ;; |
85 |
-a=* | --aa=* | -addr=* | --addr=*) |
-a=* | --a=* | -addr=* | --addr=*) |
86 |
ADDRERR=$ac_optarg ;; |
ADDRERR=$ac_optarg ;; |
87 |
|
|
88 |
*) |
*) |
89 |
# copy the file list to FL_# |
# copy the file list to FL_# |
90 |
echo "Error: don't understand argument \"$ac_option\"" |
echo "Error: don't understand argument \"$ac_option\"" |
95 |
|
|
96 |
done |
done |
97 |
|
|
98 |
|
if test ! -x $MUNPACK ; then |
99 |
|
echo "ERROR: \"$MUNPACK\" is not executable" |
100 |
|
exit 2 |
101 |
|
fi |
102 |
if test ! -e $OUTDIR ; then |
if test ! -e $OUTDIR ; then |
103 |
mkdir $OUTDIR |
mkdir $OUTDIR |
104 |
RETVAL=$? |
RETVAL=$? |
105 |
if test "x$RETVAL" = x ; then |
if test "x$RETVAL" != x0 ; then |
106 |
echo "ERROR: directory \"$OUTDIR\" doesn't exist and can't be created" |
echo "ERROR: directory \"$OUTDIR\" doesn't exist and can't be created" |
107 |
exit 1 |
exit 3 |
108 |
fi |
fi |
109 |
chgrp gcmpack $OUTDIR |
chgrp gcmpack $OUTDIR |
110 |
chmod 775 $OUTDIR |
chmod 775 $OUTDIR |
130 |
# create local copy |
# create local copy |
131 |
test -e $TEMPDIR && rm -rf $TEMPDIR |
test -e $TEMPDIR && rm -rf $TEMPDIR |
132 |
mkdir $TEMPDIR |
mkdir $TEMPDIR |
133 |
cp $INDIR"/"$file $TEMPDIR |
RETVAL=$? |
134 |
|
if test "x$RETVAL" = x0 ; then |
135 |
|
cp $INDIR"/"$file $TEMPDIR |
136 |
|
RETVAL=$? |
137 |
|
fi |
138 |
|
if test "x$RETVAL" != x0 ; then |
139 |
|
if test "x$ADDRERR" != x ; then |
140 |
|
echo "parsing email error" > tmp.$$ |
141 |
|
echo " processing file: '$INDIR/$file'" >> tmp.$$ |
142 |
|
echo -n "'mkdir $TEMPDIR' or 'cp $INDIR/$file $TEMPDIR'" >> tmp.$$ |
143 |
|
echo " returns error $RETVAL" >> tmp.$$ |
144 |
|
mail -s 'parse_emails err_0' $ADDRERR < tmp.$$ |
145 |
|
rm -f tmp.$$ |
146 |
|
fi |
147 |
|
mv -f $INDIR"/"$file $INDIR"/../fail2process/"$file |
148 |
|
continue |
149 |
|
fi |
150 |
|
|
151 |
# ignore multi-part messages |
# ignore multi-part messages |
152 |
grep "Content-Type: message/partial" $INDIR"/"$file > /dev/null 2>&1 |
grep "Content-Type: message/partial" $INDIR"/"$file > /dev/null 2>&1 |
207 |
fi |
fi |
208 |
if test $PRT = 2 ; then echo -n " '$sdir'" ; fi |
if test $PRT = 2 ; then echo -n " '$sdir'" ; fi |
209 |
mv $TEMPDIR"/"$tdir $OUTDIR"/"$sdir > /dev/null 2>&1 |
mv $TEMPDIR"/"$tdir $OUTDIR"/"$sdir > /dev/null 2>&1 |
210 |
|
RETVAL=$? |
211 |
|
if test "x$RETVAL" != x0 ; then |
212 |
|
if test "x$ADDRERR" != x ; then |
213 |
|
echo "parsing email error" > tmp.$$ |
214 |
|
echo "mv $TEMPDIR/$tdir $OUTDIR/$sdir returns error:" $RETVAL >> tmp.$$ |
215 |
|
echo -n "in dir: $TEMPDIR : " ; ls -l $TEMPDIR >> tmp.$$ |
216 |
|
echo -n "in dir: $OUTDIR : " ; ls -l $OUTDIR >> tmp.$$ |
217 |
|
mail -s 'parse_emails err_4' $ADDRERR < tmp.$$ |
218 |
|
rm -f tmp.$$ |
219 |
|
fi |
220 |
|
mv -f $INDIR"/"$file $INDIR"/../fail2process/"$file |
221 |
|
continue |
222 |
|
fi |
223 |
chmod -R a+rx $OUTDIR"/"$sdir > /dev/null 2>&1 |
chmod -R a+rx $OUTDIR"/"$sdir > /dev/null 2>&1 |
224 |
# gzip $OUTDIR"/"$sdir"/output.txt" |
# gzip $OUTDIR"/"$sdir"/output.txt" |
225 |
|
|