Fix grep fail.
[sitka/sitka-tools.git] / marc_export_custom / mucn-full-export-parallel-ebsco-wrapper.sh
CommitLineData
e11c7cc6
RJ
1#!/bin/bash
2# This is meant to be fire-and-forget
3# Only use it if you trust the output!
4export DIR=$(readlink -f $(dirname $0))
5if [ -z "${MAKEOPTS}" ]; then
6 echo "MAKEOPTS env variable is not set"
7 echo "If you really want this to be serialized, export MAKEOPTS=-j1"
8 echo "Otherwise set it about 1.5x your number of CPUs!"
9 exit 1
10fi
11[ -z "${T}" ] && export T=$(date -u +%Y%m%dT%H%M%SZ)
d1bc237c 12[ -z "${OUTDIR}" ] && export OUTDIR=$(mktemp --tmpdir -d ebsco_export.$T.XXXXXXX)
e11c7cc6
RJ
13cd $OUTDIR
14$DIR/fetch-shortcodes.sh
15cd $DIR
16time ./mucn-ebsco-full-export-parallel.sh
17cd $OUTDIR
18mkdir split
19mv *split* split/
20pbzip2 -9nvk -p4 *{marc,log}
21pbzip2 -9nv -p4 split/*{marc,log}
22$DIR/stats.sh
23cp $DIR/email-template-ebsco.sh $OUTDIR/
24cat >lftp.cmd <<EOF
25open ftp://cat00975a:neJUJ4ez@ftp.epnet.com/
26mkdir -p mucn/$T
27cd mucn/$T
28mput *csv *stats
29mput *bz2
30rels -l
31EOF
32lftp -f lftp.cmd
33chmod +x email-template-ebsco.sh
34./email-template-ebsco.sh "$T" "@$(date +%s)" >email.txt
d1bc237c 35/usr/lib/sendmail -f rjohnson@sitka.bclibraries.ca <email.txt