Improve error checking before export actually triggers the FTP upload.
[sitka/sitka-tools.git] / marc_export_custom / sitka-full-export-parallel.sh
index 0f60ca9..16b0737 100755 (executable)
@@ -37,10 +37,12 @@ process_batch() {
        MARC_EXPORT_BIN="${MARC_EXPORT_BIN}" \
        MARC_PARAMS="$MARC_PARAMS --exclusion_ini ${f}.ini" \
        $(<${OUTDIR}/${f}.id.targets)
+       make_rc=$?
 
        find ${OUTDIR} -name "${f}-${T}-split*.marc" \
        -exec cat \{} \; \
        >${OUTDIR}/${f}-${T}.marc
+       return $make_rc
 }
 
 split_suffix() {
@@ -53,13 +55,19 @@ split_suffix() {
 export SPLIT_COUNT=10000
 F=bc_eln_media SQL="$POSTSEC_QUERY"
 process_batch "$F" "${SQL}" $SPLIT_COUNT
+rc1=$?
 
 # serials for BC ELN post-secondary libraries
 export SPLIT_COUNT=10000
 F=bc_eln_serials SQL="$POSTSEC_QUERY"
 process_batch "$F" "${SQL}" $SPLIT_COUNT
+rc2=$?
 
 export SPLIT_COUNT=100000
 # full dump for outlook public libraries
 F=sitka_full_outlook SQL="$FULL_QUERY"
 process_batch "$F" "${SQL}" $SPLIT_COUNT
+rc3=$?
+
+rc=$(($rc1+$rc2+$rc3))
+exit $rc