diff --git a/scripts/bulk-mailer.js b/scripts/bulk-mailer.js index 7790a193..eceab574 100755 --- a/scripts/bulk-mailer.js +++ b/scripts/bulk-mailer.js @@ -79,7 +79,6 @@ P.resolve() }) }) .then(null, function (error) { - console.error('error', error) log.error({ op: 'send.abort', err: error @@ -89,8 +88,7 @@ P.resolve() .then(writeErrors) .then(writeUnsent) .then(function () { - console.log('bye bye!') - process.exit(runningError ? 1 : 0) + process.exit(runningError || errorCount ? 1 : 0) }) var fakeEmailCount = 0 diff --git a/scripts/reset-send-all-batches.sh b/scripts/reset-send-all-batches.sh index 8a6e1e2e..7d85e4cb 100755 --- a/scripts/reset-send-all-batches.sh +++ b/scripts/reset-send-all-batches.sh @@ -10,4 +10,5 @@ DIRNAME=${1} for BATCH in $(find ${DIRNAME} -name "*.json" -type f); do echo ${BATCH} $PWD ./reset-send-batch.sh ${BATCH} + rc=$?; if [[ $rc != 0 ]]; then exit $rc; fi done diff --git a/scripts/reset-send-batch.sh b/scripts/reset-send-batch.sh index 7326e6f6..b6bb2b24 100755 --- a/scripts/reset-send-batch.sh +++ b/scripts/reset-send-batch.sh @@ -28,11 +28,13 @@ fi echo ${BATCH} node must-reset.js -i ${BATCH} +rc=$?; if [[ $rc != 0 ]]; then exit $rc; fi ### TODO If we need more delay in between the batches the bulk-mailer itself sends, add a `-d to the below line. ### If instead of sending 10 emails at a time, the mailer should send 5 (or some other number), -b ### TODO Finally, when sending for real for real, the --send option needs to be added. node bulk-mailer.js -i ${BATCH} -t password_reset_required -e ${ERRORS_OUTPUT} -u ${UNSENT_OUTPUT} --real +rc=$?; if [[ $rc != 0 ]]; then exit $rc; fi # once the batch is completed, remove the batch file to