JBAS-1764 A/T purge CRON script
authorBill Erickson <berickxx@gmail.com>
Mon, 23 Oct 2017 17:57:22 +0000 (13:57 -0400)
committerBill Erickson <berickxx@gmail.com>
Thu, 21 Mar 2019 19:46:23 +0000 (15:46 -0400)
Signed-off-by: Bill Erickson <berickxx@gmail.com>
KCLS/utility-scripts/CRONTAB
KCLS/utility-scripts/purge_action_trigger/purge_action_trigger.sh [new file with mode: 0755]

index 77ca08d..133070c 100644 (file)
@@ -163,6 +163,9 @@ BACKSTAGE_PASSWORD = BSPASS
 # Nightly holds purging
 30 1 * * * cd $SCRIPT_DIR/purge_holds/ && ./purge_holds.sh
 
+# Nightly Action/Trigger purging
+30 2 * * * cd $SCRIPT_DIR/purge_action_trigger/ && ./purge_action_trigger.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
 
diff --git a/KCLS/utility-scripts/purge_action_trigger/purge_action_trigger.sh b/KCLS/utility-scripts/purge_action_trigger/purge_action_trigger.sh
new file mode 100755 (executable)
index 0000000..053ae72
--- /dev/null
@@ -0,0 +1,13 @@
+#!/bin/bash
+# Kick off the Action/Trigger purge function.
+# Set PGHOST, PGPASSWORD, PGUSER environment variables!
+set -eu
+PSQL="psql"
+
+echo -n "Purging A/T at "
+date +"%F %T" 
+
+echo "SET STATEMENT_TIMEOUT = 0; SELECT action_trigger.purge_events();" | $PSQL;
+
+echo -n "Purging A/T complete at "
+date +"%F %T"