20 |
echo " -a,-A STRING : email address to send output to" |
echo " -a,-A STRING : email address to send output to" |
21 |
echo " (DEF=\"\" no email is sent)" |
echo " (DEF=\"\" no email is sent)" |
22 |
echo " (-A: + save each log file)" |
echo " (-A: + save each log file)" |
23 |
|
echo " -send STRING : sending command (instead of using mpack)" |
24 |
|
echo " -sd STRING : location to save output tar file to send (DEF='$SAVDIR')" |
25 |
echo " -clean : clean output & reset" |
echo " -clean : clean output & reset" |
26 |
exit |
exit |
27 |
} |
} |
39 |
SAVELOG=0 |
SAVELOG=0 |
40 |
ADDRESS= |
ADDRESS= |
41 |
MPACK="../tools/mpack-1.6/mpack" |
MPACK="../tools/mpack-1.6/mpack" |
42 |
|
SENDCMD= |
43 |
|
SAVDIR='.' |
44 |
here=`pwd` |
here=`pwd` |
45 |
yy= |
yy= |
46 |
for xx |
for xx |
59 |
-mf ) yy=MPI_MFILE ;; |
-mf ) yy=MPI_MFILE ;; |
60 |
-a ) yy=ADDRESS ;; |
-a ) yy=ADDRESS ;; |
61 |
-A ) yy=ADDRESS ; SAVELOG=1 ;; |
-A ) yy=ADDRESS ; SAVELOG=1 ;; |
62 |
|
-send ) yy=SENDCMD ;; |
63 |
|
-sd ) yy=SAVDIR ;; |
64 |
-o ) yy=OUTDIR ;; |
-o ) yy=OUTDIR ;; |
65 |
*) echo "Error: unrecognized option: "$xx ; usage ; exit ;; |
*) echo "Error: unrecognized option: "$xx ; usage ; exit ;; |
66 |
esac |
esac |
262 |
printf "End time: " >> $SUMMARY |
printf "End time: " >> $SUMMARY |
263 |
date >> $SUMMARY |
date >> $SUMMARY |
264 |
|
|
265 |
# If address was supplied and mpack exist, then send email using mpack. |
# If address was supplied, then send email using Send-Command or mpack. |
266 |
if test "x$ADDRESS" != xNONE -a "x$ADDRESS" != x ; then |
if test "x$ADDRESS" != xNONE -a "x$ADDRESS" != x ; then |
267 |
if test -x $MPACK ; then |
if test "x$SENDCMD" = x ; then |
268 |
tar -cf $DRESULTS".tar" $DRESULTS > /dev/null 2>&1 \ |
# if Send-Command is empty and mpack exist, then send email using mpack. |
269 |
&& gzip $DRESULTS".tar" \ |
if test -x $MPACK ; then SENDCMD=$MPACK |
270 |
&& $MPACK -s MITgcm-test -m 3555000 $DRESULTS".tar.gz" $ADDRESS |
else |
271 |
|
echo "Warning: $MPACK is not executable => no email was sent" |
272 |
|
echo |
273 |
|
fi |
274 |
|
fi |
275 |
|
if test "x$SENDCMD" != x ; then |
276 |
|
#echo " run: $SENDCMD -s MITgcm-test -m 3555000 ${SAVDIR}/${DRESULTS}".tar.gz" $ADDRESS" |
277 |
|
tar -cf ${SAVDIR}/${DRESULTS}".tar" $DRESULTS > /dev/null 2>&1 \ |
278 |
|
&& gzip ${SAVDIR}/${DRESULTS}".tar" \ |
279 |
|
&& $SENDCMD -s MITgcm-test -m 3555000 ${SAVDIR}/${DRESULTS}".tar.gz" $ADDRESS |
280 |
out=$? |
out=$? |
281 |
if test "x$out" != x0 ; then |
if test "x$out" != x0 ; then |
282 |
echo |
echo |
290 |
echo " \"$ADDRESS\"" |
echo " \"$ADDRESS\"" |
291 |
echo |
echo |
292 |
fi |
fi |
293 |
test -f $DRESULTS".tar" && rm -f $DRESULTS".tar" |
test -f ${SAVDIR}/${DRESULTS}".tar" && rm -f ${SAVDIR}/${DRESULTS}".tar" |
294 |
test -f $DRESULTS".tar.gz" && rm -f $DRESULTS".tar.gz" |
test -f ${SAVDIR}/${DRESULTS}".tar.gz" && rm -f ${SAVDIR}/${DRESULTS}".tar.gz" |
|
else |
|
|
echo "Warning: $MPACK is not executable => no email was sent" |
|
|
echo |
|
295 |
fi |
fi |
296 |
fi |
fi |
297 |
|
|