From: rsoulliere Date: Wed, 17 Jul 2013 19:38:36 +0000 (-0400) Subject: Use a flat file list of deletes generated by SQL for Summon. X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;p=contrib%2Fmohawk.git Use a flat file list of deletes generated by SQL for Summon. --- diff --git a/summon/README b/summon/README index 3ef9585..9779080 100644 --- a/summon/README +++ b/summon/README @@ -10,6 +10,9 @@ Requirements * Needs to be run on an server running Evergreen. * It should be run as the *opensrf* user. * You will need to know your Evergreen database administrator connection information. +* Summon must be configured to accept a flat file of IDs for deleted + records. Contact your Serial Solutions technical support for details. + Installation ------------ @@ -37,8 +40,9 @@ Uploading Deletes and Updates to Summon . Edit your SQL files _deleted_bibs.sql_ and _updated_bibs.sql_ as needed to limit the bib records to be exported into the MARC file. . Edit the ftp transfer script: _/home/opensrf/summon/ftp_transfer.sh_ and set the ftp username and password provided by Serials Solution. . Run _bib_export_deletes_and_updates.sh_ as *opensrf*. -. New MARC files should be located in /home/opensrf/summon/deletes/deletes and /home/opensrf/summon/deletes/updates. These should - represent the deletes and updates made to bib records on the day you ran the script. The file name should include today's date. +. A flat file of deleted records will be located in_/home/opensrf/summon/deletes/deletes_ +. A MARC file should be located in /home/opensrf/summon/deletes/updates. These should + represent the updates made to bib records on the day you ran the script. The file name should include today's date. . Check the MARC files to ensure format looks good. . Files should have also been ftp'd automatically to the Summon server. You might want to contact Serials Solutions to ensure it looks good on their end. . If you encounter any issues, check the log files in /home/opensrf/summon/log to see where problems occurred. diff --git a/summon/bib_export_deletes_and_updates.sh b/summon/bib_export_deletes_and_updates.sh index 81d7f42..bed9b04 100644 --- a/summon/bib_export_deletes_and_updates.sh +++ b/summon/bib_export_deletes_and_updates.sh @@ -18,9 +18,11 @@ psql -h $db_host -U $db_user -d $db -p $db_port -f /home/opensrf/summon/deleted_ echo "Bib ids selected for export:" > /home/opensrf/summon/log/deleted_bibs.log."$(date "+%Y%m%d")" cat /home/opensrf/summon/deleted_bibs.ids >> /home/opensrf/summon/log/deleted_bibs.log."$(date "+%Y%m%d")" -#sql Remove empty line at end of SQL output file. -sed '/^$/d' /home/opensrf/summon/deleted_bibs.ids > /home/opensrf/summon/tt -mv /home/opensrf/summon/tt /home/opensrf/summon/deleted_bibs.ids +#sql Remove extra lines at end of SQL output file. +sed '/^$/d' /home/opensrf/summon/deleted_bibs.ids | sed '/id/d' | sed '/---/d' | sed '/rows/d' | sed 's/ //g' > /home/opensrf/summon/tt +mv /home/opensrf/summon/tt /home/opensrf/summon/deletes/deleted_bibs-$(date +"%Y%m%d").ids + + #pass the bib ids to the marc_export program to write marc records to deleted_bibs.mrc # and write out output summary to deleted_bibs.log @@ -38,7 +40,8 @@ echo "Bib ids selected for export:" > /home/opensrf/summon/log/updated_bibs.log. cat /home/opensrf/summon/updated_bibs.ids >> /home/opensrf/summon/log/updated_bibs.log."$(date +"%Y%m%d")" #sql Remove empty line at end of SQL output file. -sed '/^$/d' /home/opensrf/summon/updated_bibs.ids > /home/opensrf/summon/tt2 + +sed '/^$/d' /home/opensrf/summon/updated_bibs.ids | sed '/id/d' | sed '/---/d' | sed '/rows/d' | sed 's/ //g' > /home/opensrf/summon/tt2 mv /home/opensrf/summon/tt2 /home/opensrf/summon/updated_bibs.ids #pass the bib ids to the marc_export program to write marc records to deleted_bibs.mrc @@ -52,7 +55,8 @@ cat /home/opensrf/summon/updated_bibs.ids | /openils/bin/marc_export -c /openils # call ftp script to ftp the MARC files onto the summon server. echo "FTP bibs:" >> /home/opensrf/summon/log/deleted_bibs.log."$(date +"%Y%m%d")" -/home/opensrf/summon/ftp_transfer.sh /home/opensrf/summon/deletes/deletes-$(date +"%Y%m%d").marc deletes-$(date +"%Y-%m-%d-%H-%M-%S").marc deletes +/home/opensrf/summon/ftp_transfer.sh /home/opensrf/summon/deletes/deleted_bibs-$(date +"%Y%m%d").ids deletes-$(date +"%Y-%m-%d-%H-%M-%S").deletes deletes + echo "FTP bibs:" >> /home/opensrf/summon/log/updated_bibs.log."$(date +"%Y%m%d")" /home/opensrf/summon/ftp_transfer.sh /home/opensrf/summon/updates/updates-$(date +"%Y%m%d").marc updates-$(date +"%Y-%m-%d-%H-%M-%S").marc updates