3 # A script to export ISBNs from PINES records for NoveList Select OPAC Integration
5 OUTBOX="$WORKDIR/outbox"
6 OUTFILE="pines_isbns_`date +%F`.csv"
7 OUTPATH="$OUTBOX/$OUTFILE"
10 FTP_ADDR="ftp.example.com"
11 FTP_PATH="remote/path"
14 EBSCO_EMAIL="Support@vendor.com"
15 ADMIN_EMAIL="my-admins@mylibrarysystem.org"
16 EMAIL_SUBJECT="ISBN Update - galileo (for PINES)"
19 if [ ! -d "$OUTBOX" ]; then
21 echo "Creating directory $OUTBOX."
24 psql -U $DB_USER -o $OUTPATH -A -t -c "select isbn from reporter.materialized_simple_record rmsr join biblio.record_entry bre on (rmsr.id = bre.id and not bre.deleted) where isbn is not null and isbn <> '{NULL}'" $DB_NAME
25 sed -i "s/[{}]//g" $OUTPATH
26 sed -i "s/,/\n/g" $OUTPATH
28 pftp -n -v $FTP_ADDR <<EOT
29 user $FTP_USER $FTP_PASS
35 echo "PINES ISBN upload completed for `date +%F`" | mutt -s "$EMAIL_SUBJECT" -c "$ADMIN_EMAIL" "$EBSCO_EMAIL"