JBAS-680 util scripts conditional alert emails
authorBill Erickson <berickxx@gmail.com>
Tue, 26 May 2015 14:47:31 +0000 (10:47 -0400)
committerBill Erickson <berickxx@gmail.com>
Thu, 21 Mar 2019 19:46:23 +0000 (15:46 -0400)
Allow batch job emails to be sent on a conditional basis so that
individual scripts do not require modification depending on the host.

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

index d050013..846c0ce 100644 (file)
@@ -13,6 +13,8 @@ SCRIPT_DIR = /home/opensrf/Evergreen/KCLS/utility-scripts
 PGUSER     = evergreen
 PGDATABASE = evergreen
 PGHOST     = localhost # change for cluster install
+# Uncomment on production to generate email alerts for certain actions
+# EG_UTIL_NOTIFY = 1 
 
 # hold targeter
 */1 * * * *   . ~/.bashrc && $EG_BIN/hold_targeter.pl $SRF_CORE 2> /dev/null
index f50ad9b..a3c0c2d 100755 (executable)
@@ -1,6 +1,11 @@
 #!/bin/bash
-
 # Script to change item copy locations so that the
 # copy location owning library matches the item's circ library
+
 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
+
+if [ -n "$EG_UTIL_NOTIFY" ]; then
+    cat log.fix_copy_locations \
+        | mailx -s "Copy location fix report" \
+        bbonner@kcls.org,mcarlson@kcls.org
+fi
index 4476212..5e0f7f9 100755 (executable)
@@ -1,10 +1,11 @@
 #!/bin/bash
-
 # Script to delete empty volumes, i.e., non-located-URI
 # acns that have no non-deleted copies linked to them
 
 psql -U evergreen < del_all_empty_vols.sql > log.del_all_empty_volumes
-# TODO: un-comment on prod util server only
-#cat log.del_all_empty_volumes \
-#    | mailx -s "Empty volume deletion report" \
-#    bbonner@kcls.org,mcarlson@kcls.org
+
+if [ -n "$EG_UTIL_NOTIFY" ]; then
+    cat log.del_all_empty_volumes \
+        | mailx -s "Empty volume deletion report" \
+        bbonner@kcls.org,mcarlson@kcls.org
+fi
index 621fc2b..ba1c7d4 100755 (executable)
@@ -1,9 +1,10 @@
 #!/bin/bash
-
 # Script to inactive patron cards, per HS#18506
 
 psql -U evergreen < remove_inactive_patron_cards.sql > log.remove_inactive_patron_cards
-# TODO: un-comment on production util server only
-#cat log.remove_inactive_patron_cards \
-#    | mailx -s "Inactive patron card deletion report" \
-#    bbonner@kcls.org,mcarlson@kcls.org,ebooks@kcls.org
+
+if [ -n "$EG_UTIL_NOTIFY" ]; then
+    cat log.remove_inactive_patron_cards \
+        | mailx -s "Inactive patron card deletion report" \
+        bbonner@kcls.org,mcarlson@kcls.org,ebooks@kcls.org
+fi