JBAS-258 various utility server script repairs
authorBill Erickson <berickxx@gmail.com>
Thu, 18 Dec 2014 18:46:54 +0000 (13:46 -0500)
committerBill Erickson <berickxx@gmail.com>
Thu, 21 Mar 2019 19:46:23 +0000 (15:46 -0400)
 * Give all batch SQL scripts a 0 statement timeout
 * Avoid cd'ing into nonexistent directories

Signed-off-by: Bill Erickson <berickxx@gmail.com>
KCLS/utility-scripts/copy_loc_fix/fix_copy_locations.sql
KCLS/utility-scripts/copy_loc_fix/run_copy_location_fix.sh
KCLS/utility-scripts/del_empty_vol/del_all_empty_vols.sql
KCLS/utility-scripts/inactive_cards/remove_inactive_patron_cards.sql
KCLS/utility-scripts/reshelving/reshelving.sh

index d4443a2..e774f53 100644 (file)
@@ -2,6 +2,8 @@
 
 BEGIN;
 
+SET SESSION STATEMENT_TIMEOUT TO 0;
+
 UPDATE asset.copy a
 SET location = c.id
 FROM asset.copy_location b, asset.copy_location c
index ebb3390..f50ad9b 100755 (executable)
@@ -2,6 +2,5 @@
 
 # Script to change item copy locations so that the
 # copy location owning library matches the item's circ library
-cd /home/opensrf/esi_data_services
 psql -U evergreen < fix_copy_locations.sql > log.fix_copy_locations
-cat log.fix_copy_locations | mailx -s "Copy location fix report" bbonner@kcls.org,mcarlson@kcls.org
+#cat log.fix_copy_locations | mailx -s "Copy location fix report" bbonner@kcls.org,mcarlson@kcls.org
index ba0757c..0428f75 100644 (file)
@@ -1,6 +1,8 @@
 \echo running empty volume deletion
 BEGIN;
 
+SET SESSION STATEMENT_TIMEOUT TO 0;
+
 \echo compiling list of volumes to delete
 TRUNCATE TABLE m_kcls.vols_to_delete;
 
index a39f2b7..a1ab51d 100644 (file)
@@ -1,4 +1,7 @@
 BEGIN;
+
+SET SESSION STATEMENT_TIMEOUT TO 0;
+
 SELECT  o.barcode as "Old BC", n.barcode as "New BC" FROM actor.card AS o INNER JOIN actor.card AS n ON o.usr = n.usr WHERE NOT o.active AND n.active AND EXISTS (SELECT usr FROM actor.card WHERE usr = o.usr AND active);
 
 \echo Backing up inactive patron cards
index 91de2b7..f217301 100755 (executable)
@@ -4,8 +4,7 @@ set -eu
 echo -n "Reshelving copies at "
 date +"%F %T" 
 
-psql -U evergreen \
-    -f /home/opensrf/scripts/reshelving/reshelving.sql
+psql -U evergreen -f reshelving.sql
 
 echo -n "Reshelving complete at "
 date +"%F %T"