Error checking and paths.
[sitka/sitka-tools.git] / marc_export_custom / email-template.sh
CommitLineData
8ec81273
RJ
1#!/bin/bash
2t1=$1
3t1=${t1/T/ }
4t1=${t1/??Z}
5t2=$2
6t2=${t2/T/ }
7t2=${t2/??Z}
8
9if [ -z "$t1" -o -z "$t2" ]; then
10 echo "Usage: $0 'Generate timestamp' 'Submit timestamp'" 1>&2
11fi
12
13cat <<EOF
14Date: $(date -uR)
15From: "Robin H. Johnson" <rjohnson@sitka.bclibraries.ca>
16Subject: SITKA Outlook export $(date +%Y/%m/%d -d "$t1") (includes ELN media/serials)
17To: Anne Morgan <anne.morgan@bclibrary.ca>, Ramiro Castillo <rcr@auto-graphics.com>, Heather Morrison <heatherm@eln.bc.ca>
18Cc: "Robin H. Johnson" <rjohnson@sitka.bclibraries.ca>, Ben Hyman <ben.hyman@cooperative.bclibraries.ca>, sherbert@sitka.bclibraries.ca
19
20Full automated Outlook export
21
22Notes:
e1fce3d3 23...
8ec81273
RJ
24
25Directory for uploads:
804191d8 26sitka/$T
8ec81273
RJ
27
28Submission timestamp:
29$(date -uR -d "$t2")
30
31Generation timestamp:
32$(date -uR -d "$t1")
33
34Submission method:
35FTP
36
37Compressed sizes in bytes:
38$(head -n2 *stats | awk '/.marc.bz2$/{print $9,$5}')
39
40Uncompressed size in bytes:
41$(head -n2 *stats | awk '/.marc$/{print $9,$5}')
42$(find -name '*.csv' -printf '%f %s\n')
43
44Number of records submitted:
45$(grep -h Filename -A5 $i *stats | awk '/.marc$/{print $3,$1}')
46
47SHA1 checksums:
48$(egrep '^[a-f0-9]{32}' *stats -h |sort -k +2)
49$(sha1sum *.csv)
50EOF