From: Jeff Davis Date: Tue, 24 Jan 2017 20:04:02 +0000 (-0800) Subject: Update MARC export process for Outlook, per RT#42708 X-Git-Url: https://git.sitka.bclibraries.ca/gitweb/?p=sitka%2Fsitka-tools.git;a=commitdiff_plain;h=ec4760e57b588ae469917276c101de0c0e00690e Update MARC export process for Outlook, per RT#42708 Signed-off-by: Jeff Davis --- diff --git a/marc_export_custom/email-template-outlook.sh b/marc_export_custom/email-template-outlook.sh index 9107550..a214f69 100755 --- a/marc_export_custom/email-template-outlook.sh +++ b/marc_export_custom/email-template-outlook.sh @@ -10,6 +10,8 @@ if [ -z "$t1" -o -z "$t2" ]; then echo "Usage: $0 'Generate timestamp' 'Submit timestamp'" 1>&2 fi +FILELIST=`cat Manifest` + # illsupport@bclibrary.ca goes to Mari.Martin@gov.bc.ca and Bob.Yuan@gov.bc.ca cat <field('852'); - @marc856 = $r->field('856'); + my @marc852 = $r->field('852'); + my @marc856 = $r->field('856'); # If not, we should NOT add this item to the export # ... but we may still want the record if it has an 856 return unless ( @marc852 || ($with_ebooks && @marc856) ); } else { - add_bib_holdings($bib, $r); + add_bib_holdings($bib, $r) if ($holdings); } } diff --git a/marc_export_custom/mucn-full-export-parallel-ebsco-wrapper.sh b/marc_export_custom/mucn-full-export-parallel-ebsco-wrapper.sh index 5d9601d..4bb731d 100755 --- a/marc_export_custom/mucn-full-export-parallel-ebsco-wrapper.sh +++ b/marc_export_custom/mucn-full-export-parallel-ebsco-wrapper.sh @@ -13,7 +13,7 @@ fi [ -z "${OUTDIR}" ] && export OUTDIR=$(mktemp --tmpdir -d ${NAME}_export.$T.XXXXXXX) cd $OUTDIR echo Prep $(date -uR)/@$(date +%s) -$DIR/fetch-shortcodes.sh +$DIR/fetch-shortcodes.sh shortcodes.csv cd $DIR echo Exporting $(date -uR)/@$(date +%s) export PERLOPT=-X diff --git a/marc_export_custom/outlook-curl.sh b/marc_export_custom/outlook-curl.sh new file mode 100755 index 0000000..679a30c --- /dev/null +++ b/marc_export_custom/outlook-curl.sh @@ -0,0 +1,8 @@ +#!/bin/bash +# Upload a file to Auto-Graphics ShareFile system using WebDAV/curl +# Usage: ./outlook-curl.sh +FILE=$1 +USERNAME=$2 +PASSWORD=$3 +LOG="outlook-curl.log" +curl -k -u $USERNAME:$PASSWORD -T $FILE https://agcloud.auto-graphics.com/public.php/webdav/sitka/$FILE 2> $LOG diff --git a/marc_export_custom/sitka-full-export-parallel-outlook-wrapper.sh b/marc_export_custom/sitka-full-export-parallel-outlook-wrapper.sh index 362a8e5..b66c4f8 100755 --- a/marc_export_custom/sitka-full-export-parallel-outlook-wrapper.sh +++ b/marc_export_custom/sitka-full-export-parallel-outlook-wrapper.sh @@ -1,6 +1,10 @@ #!/bin/bash # This is meant to be fire-and-forget # Only use it if you trust the output! + +CURL_USERNAME=$1 +CURL_PASSWORD=$2 + export DIR=$(readlink -f $(dirname $0)) NAME=outlook if [ -z "${MAKEOPTS}" ]; then @@ -13,7 +17,7 @@ fi [ -z "${OUTDIR}" ] && export OUTDIR=$(mktemp --tmpdir -d ${NAME}_export.$T.XXXXXXX) cd $OUTDIR echo Prep $(date -uR)/@$(date +%s) -$DIR/fetch-shortcodes.sh +$DIR/fetch-shortcodes.sh shortcodes-$T.csv cd $DIR echo Exporting $(date -uR)/@$(date +%s) export PERLOPT=-X @@ -37,22 +41,19 @@ if [ $rc -ne 0 -o $grep_result -ne 0 ]; then cat *stats 1>&2 exit 1 fi -echo FTP $(date -uR)/@$(date +%s) -# Two passes with mget, so the stats and csv are always there first -# they are small and serve to show we might be uploading more, and they have -# checksums so AutoGraphics can check the upload -FTPSITE=ftp://ftpbcuc:bcv15c@ftp.auto-graphics.com/ -FTPDIR=sitka/$T -cat >lftp.cmd <&2 + exit 1 +fi + +# individually upload all required output files with curl +for CURL_FILE in `ls $OUTDIR | egrep '(.bz2|.stats|.csv)$' | grep -v script.log.bz2` ; do + $DIR/outlook-curl.sh $CURL_FILE $CURL_USERNAME $CURL_PASSWORD + echo $CURL_FILE >> $OUTDIR/Manifest +done + cp $DIR/email-template-${NAME}.sh $OUTDIR/ chmod +x email-template-${NAME}.sh ./email-template-${NAME}.sh "$T" "@$(date +%s)" >email.txt