Fix email run part.
[sitka/sitka-tools.git] / marc_export_custom / sitka-full-export-parallel-outlook-wrapper.sh
CommitLineData
e404bb37
RJ
1#!/bin/bash
2# This is meant to be fire-and-forget
3# Only use it if you trust the output!
e38e56a8 4export DIR=$(readlink -f $(dirname $0))
e404bb37
RJ
5[ -z "${T}" ] && export T=$(date -u +%Y%m%dT%H%M%SZ)
6[ -z "${OUTDIR}" ] && export OUTDIR=$(mktemp --tmpdir -d outlook_export.XXXXXXX)
7cd $OUTDIR
8$DIR/fetch-shortcodes.sh
9cd $DIR
10time ./sitka-full-export-parallel.sh
11cd $OUTDIR
12mkdir split
13mv *split* split/
14pbzip2 -9nvk -p4 *{marc,log}
15pbzip2 -9nv -p4 split/*{marc,log}
16$DIR/stats.sh
17cp $DIR/email-template.sh $OUTDIR/
18cat >lftp.cmd <<EOF
19open ftp://ftpbcuc:bcv15c@ftp.auto-graphics.com/
20mkdir -p sitka/$T
21cd sitka/$T
22mput *csv *stats
23mput *bz2
24rels -l
25EOF
26lftp -f lftp.cmd
27chmod +x email-template.sh
e8e2109c
RJ
28./email-template.sh "$T" "@$(date +%s)" >email.txt
29sendmail <email.txt