From: Bill Erickson Date: Mon, 17 Jul 2017 19:15:31 +0000 (-0400) Subject: Backstage quarterly bib export count email X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=087c0a10adcba0faadddc2be0228935d2e6614f1;p=working%2FEvergreen.git Backstage quarterly bib export count email Send an email after the quarterly bib export file has been generated and uploaded with the count of bib records in the file. Signed-off-by: Bill Erickson --- diff --git a/KCLS/authority-control/backstage/backstage-agent.sh b/KCLS/authority-control/backstage/backstage-agent.sh index 029a97a0e6..8fd98c5a09 100755 --- a/KCLS/authority-control/backstage/backstage-agent.sh +++ b/KCLS/authority-control/backstage/backstage-agent.sh @@ -33,6 +33,8 @@ CUR_YEAR4=$(date +'%Y') CUR_QTR=$(( ($(date +%-m)-1)/3+1 )) PREV_QTR_START_DATE="" PREV_QTR_END_DATE="" +# email Bill Erickson and Sally Smith with quarterly bib export totals +EMAIL_RECIP=bserickson@kcls.org,ssmith@kcls.org function die { echo "$@" 1>&2 ; exit 1; } # thanks, internet. @@ -169,6 +171,12 @@ function bs_export_qtrly_bibs { # Put a file into the working directory with the export # date so the importer can refer to it later. echo "$(date +'%F')" > "$WORKING_DIR/EXPORT_DATE" + + # count the number of MARC record separator characters + count=$(cat $EXPORT_FILE | perl -e '$/="\x1D";$c = 0;$c++ while (<>);print "$c";') + echo "" | mailx -s \ + "Exported $count Bibs for Backstage Q$CUR_QTR $CUR_YEAR4" \ + $EMAIL_RECIP fi else die "No MARC export file was created at $EXPORT_FILE"