2 # This is meant to be fire-and-forget
3 # Only use it if you trust the output!
4 export DIR=$(readlink -f $(dirname $0))
5 if [ -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!"
11 [ -z "${T}" ] && export T=$(date -u +%Y%m%dT%H%M%SZ)
12 [ -z "${OUTDIR}" ] && export OUTDIR=$(mktemp --tmpdir -d outlook_export.$T.XXXXXXX)
14 echo Prep $(date -uR)/@$(date +%s)
15 $DIR/fetch-shortcodes.sh
18 echo Exporting $(date -uR)/@$(date +%s)
19 time ./sitka-full-export-parallel.sh
24 echo Compressing $(date -uR)/@$(date +%s)
25 pbzip2 -9nk -p4 *{marc,log}
26 pbzip2 -9n -p4 split/*{marc,log}
27 echo Stats $(date -uR)/@$(date +%s)
29 echo Sanity $(date -uR)/@$(date +%s)
30 # Look for zeros in the output marc
31 egrep -vsq '^([[:space:]]*0){2}.*marc$' *stats
34 if [ $rc -ne 0 -o $grep_result -ne 0 ]; then
35 echo "Failed to run export! Human needed! export=$rc grep_sanity=$grep_result" 1>&2
39 echo FTP $(date -uR)/@$(date +%s)
40 # Two passes with mget, so the stats and csv are always there first
41 # they are small and serve to show we might be uploading more, and they have
42 # checksums so AutoGraphics can check the upload
44 open ftp://ftpbcuc:bcv15c@ftp.auto-graphics.com/
52 echo Email $(date -uR)/@$(date +%s)
53 cp $DIR/email-template-outlook.sh $OUTDIR/
54 chmod +x email-template-outlook.sh
55 ./email-template-outlook.sh "$T" "@$(date +%s)" >email.txt
56 /usr/lib/sendmail -t -f rjohnson@sitka.bclibraries.ca <email.txt