]> git.evergreen-ils.org Git - contrib/pines.git/blob - longoverdue/batch_process_longoverdue_notices.sh
add local git tar script
[contrib/pines.git] / longoverdue / batch_process_longoverdue_notices.sh
1 #!/bin/bash
2
3 # a script to churn through processing longoverdue notices.  In this
4 # case, the A/T process was choking because we were trying to process
5 # too large a chunk of notices.  We decided that 3,000 at a time was
6 # a good size to loop through.
7
8 COUNT=`psql -U evergreen -h db02 -A -t -c "select count(*) from action_trigger.event where state = 'collected' and event_def = 50"`
9
10 while [ "$COUNT" -gt "0" ]; do
11         echo "Begin loop at `date`.  Count is $COUNT."
12         psql -U evergreen -h db01 -c "update action_trigger.event set start_time = null, update_time = null, update_process = null, state = 'pending', template_output = null where id in (select id from action_trigger.event where event_def = 50 and state = 'collected' limit 3000)"
13         time /openils/bin/action_trigger_runner.pl --osrf-config /openils/conf/opensrf_core.xml --verbose --run-pending --granularity longoverdue-notices --granularity-only
14         COUNT=`psql -U evergreen -h db02 -A -t -c "select count(*) from action_trigger.event where state = 'collected' and event_def = 50"`
15         echo "End loop at `date`.  Count is now $COUNT."
16 done