--- /dev/null
+-- Deploy kcls-evergreen:purge-holds to pg
+-- requires: audit-table-maint
+
+BEGIN;
+
+
+-- Start by purging really old holds.
+-- The age will march forward as we work through batches.
+UPDATE config.global_flag
+ SET enabled = TRUE, value = '5 years'
+ WHERE name ~ 'history.hold.retention_age';
+
+COMMIT;
--- /dev/null
+-- Revert kcls-evergreen:purge-holds from pg
+
+BEGIN;
+
+-- XXX Add DDLs here.
+
+COMMIT;
vand-delete-speed-indexes [self-reg-net-access-level] 2016-09-30T14:52:21Z Bill Erickson <berickxx@gmail.com> # Indexes to speed up vandelay queue deleting
auth-prop-mods-bib-meta [ingram-edi-mods] 2016-06-13T16:07:28Z Bill Erickson <berickxx@gmail.com> # Authority propagation udpates bib editor/edit_date
backstage-exports-continued [ingram-edi-mods] 2016-06-20T20:28:38Z Bill Erickson <berickxx@gmail.com> # Updating in-db export utilities
+purge-holds [audit-table-maint] 2016-09-21T16:01:57Z Bill Erickson <berickxx@gmail.com> # Holds purge settings
2.7-to-2.9-upgrade [backstage-exports-continued] 2016-12-09T20:27:17Z Bill Erickson <berickxx@gmail.com> # 2.7 to 2.9 Upgrade
2.7-to-2.9-upgrade-part-2 [2.7-to-2.9-upgrade] 2016-12-12T15:19:07Z Bill Erickson <berickxx@gmail.com> # 2.7 to 2.9 Upgrade Secondary Updates
--- /dev/null
+-- Verify kcls-evergreen:purge-holds on pg
+
+BEGIN;
+
+-- XXX Add verifications here.
+
+ROLLBACK;
#0 0 * * 5 cd $SCRIPT_DIR/purge_circs/ && ./purge_circulations.sh --start 2013-01-01 --end 2014-01-01 --increment "1 year" --duration 120 >> /openils/var/log/purge_circs.log
#0 0 * * 6 cd $SCRIPT_DIR/purge_circs/ && ./purge_circulations.sh --start 2014-01-01 --end $(date -d -1year-1month +'\%F') --increment "1 year" --duration 120 >> /openils/var/log/purge_circs.log
+# Nightly holds purging
+30 1 * * * cd $SCRIPT_DIR/purge_holds/ && ./purge_holds.sh
+
# Process and archive student import files each Sunday night at 11pm
# 0 23 * * 0 cd /home/opensrf/Evergreen/KCLS/utility-scripts/import_students && ./sftp-client-agent.sh -b db01 -p -a
--- /dev/null
+#!/bin/bash
+# Kick off the holds purge function.
+# Set PGHOST, PGPASSWORD, PGUSER environment variables!
+set -eu
+PSQL="psql"
+
+echo -n "Purging holds at "
+date +"%F %T"
+
+echo "SET STATEMENT_TIMEOUT = 0; SELECT action.purge_holds();" | $PSQL;
+
+echo -n "Purging holds complete at "
+date +"%F %T"