From: Bill Erickson Date: Mon, 15 May 2017 15:32:38 +0000 (-0400) Subject: JBAS-1722 Automate backstage bib collisions processing X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=fe0a0b7552934f87d4945c9ecb937d7932b935b0;p=working%2FEvergreen.git JBAS-1722 Automate backstage bib collisions processing Adds a separate command for processing bib collisions files. ./backstage-agent.sh -p -c Leaving as a separate command for now so that I can run it manually the first time or two. Will later integrate this into the quarterly results processing task. Signed-off-by: Bill Erickson --- diff --git a/KCLS/authority-control/backstage/backstage-agent.sh b/KCLS/authority-control/backstage/backstage-agent.sh index 91037f336e..029a97a0e6 100755 --- a/KCLS/authority-control/backstage/backstage-agent.sh +++ b/KCLS/authority-control/backstage/backstage-agent.sh @@ -19,6 +19,11 @@ REPORTS_DIR_BASE="/openils/var/web/standalone/backstage" REPORTS_DIR="" WORKING_DIR="" +# collisions file processing +ADMIN_PASSWORD="" +MERGE_PROFILE=104 # "Backstage Field Protection" +BIB_QUEUE=5413 # "Backstage Quarterly" + SCRIPT_DIR=$PWD CURL="curl --silent --show-error --user $BACKSTAGE_USER:$BACKSTAGE_PASSWORD"; @@ -171,6 +176,43 @@ function bs_export_qtrly_bibs { } +function bs_import_bib_collisions { + bs_set_qtr_dates; + bs_make_dirs "quarterly" + CFILE="$WORKING_DIR/bib-collisions.mrc"; + + echo "Processing bib collisions files $CFILE" + + if [ ! -f "$CFILE" ]; then + echo "No bib collisions file to process." + return; + fi; + + if [ ! -s "$CFILE" ]; then + echo "Bib collisions file is empty" + return; + fi; + + if [ ! -f "$WORKING_DIR/bib-collisions.bak.mrc" ]; then + echo "Making collisions file backup." + cp $CFILE "$WORKING_DIR/bib-collisions.bak.mrc"; + else + echo "Collisions file backup already exists" + fi; + + cd /openils/bin/ + perl ./marc_stream_importer.pl \ + --spoolfile $CFILE \ + --user admin \ + --password $ADMIN_PASSWORD \ + --bib-auto-overlay-exact \ + --bib-queue $BIB_QUEUE \ + --merge-profile $MERGE_PROFILE + + cd $SCRIPT_DIR; +} + + # Sets the start and end dates of the previous quarter. # Probably a more elegant way to do this, oh well. function bs_set_qtr_dates { @@ -242,12 +284,14 @@ USAGE } -while getopts "abqhd:" opt; do +while getopts "abqhd:p:c" opt; do case $opt in d) export PGHOST=$OPTARG;; + p) ADMIN_PASSWORD=$OPTARG;; a) bs_import_monthly_auths;; q) bs_import_qtrly_results;; b) bs_export_qtrly_bibs;; + c) bs_import_bib_collisions;; h) usage;; esac done;