From: Bill Erickson Date: Tue, 26 May 2015 14:47:31 +0000 (-0400) Subject: JBAS-680 util scripts conditional alert emails X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=28e3179c01d30311fd4222ca29a008f04ca34e1b;p=working%2FEvergreen.git JBAS-680 util scripts conditional alert emails 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 --- diff --git a/KCLS/utility-scripts/CRONTAB b/KCLS/utility-scripts/CRONTAB index d0500137e8..846c0ce125 100644 --- a/KCLS/utility-scripts/CRONTAB +++ b/KCLS/utility-scripts/CRONTAB @@ -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 diff --git a/KCLS/utility-scripts/copy_loc_fix/run_copy_location_fix.sh b/KCLS/utility-scripts/copy_loc_fix/run_copy_location_fix.sh index f50ad9b344..a3c0c2d40a 100755 --- a/KCLS/utility-scripts/copy_loc_fix/run_copy_location_fix.sh +++ b/KCLS/utility-scripts/copy_loc_fix/run_copy_location_fix.sh @@ -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 diff --git a/KCLS/utility-scripts/del_empty_vol/run_empty_vol_delete.sh b/KCLS/utility-scripts/del_empty_vol/run_empty_vol_delete.sh index 4476212132..5e0f7f9046 100755 --- a/KCLS/utility-scripts/del_empty_vol/run_empty_vol_delete.sh +++ b/KCLS/utility-scripts/del_empty_vol/run_empty_vol_delete.sh @@ -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 diff --git a/KCLS/utility-scripts/inactive_cards/remove_inactive_patron_cards.sh b/KCLS/utility-scripts/inactive_cards/remove_inactive_patron_cards.sh index 621fc2b5d1..ba1c7d4f71 100755 --- a/KCLS/utility-scripts/inactive_cards/remove_inactive_patron_cards.sh +++ b/KCLS/utility-scripts/inactive_cards/remove_inactive_patron_cards.sh @@ -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