Improve error checking before export actually triggers the FTP upload.
[sitka/sitka-tools.git] / marc_export_custom / sitka-full-export-parallel-outlook-wrapper.sh
index b5a5dc5..b484ba5 100755 (executable)
@@ -14,12 +14,20 @@ cd $OUTDIR
 $DIR/fetch-shortcodes.sh
 cd $DIR
 time ./sitka-full-export-parallel.sh
+rc=$?
 cd $OUTDIR
 mkdir split
 mv *split* split/
 pbzip2 -9nvk -p4 *{marc,log}
 pbzip2 -9nv -p4 split/*{marc,log}
 $DIR/stats.sh
+egrep -sq '^([[:space:]]*0){2}' *stats
+grep_result=$?
+if [ $rc -ne 0 -o $grep_result -ne 0 ]; then
+       echo "Failed to run export! Human needed! export=$rc grep=$rc" 1>&2
+       cat *stats 1>&2
+       exit 1
+fi
 cp $DIR/email-template-outlook.sh $OUTDIR/
 cat >lftp.cmd <<EOF
 open ftp://ftpbcuc:bcv15c@ftp.auto-graphics.com/