From 5650fc1c15672d8bf917b71a8e8b3215c22b77f8 Mon Sep 17 00:00:00 2001 From: Petr Baudis Date: Wed, 18 Jun 2008 16:17:25 +0200 Subject: [PATCH] update.sh: Send only single failure/recovery mails instead of repeated failure notifications. --- update.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/update.sh b/update.sh index e57898d..7f1515c 100755 --- a/update.sh +++ b/update.sh @@ -12,11 +12,15 @@ mail="$(cat owner)" bang() { if ! "$@" >>"$log" 2>&1; then + if ! [ -e .banged ]; then { echo "$* failed with error code $?" + echo "you will not receive any more notifications until recovery" echo "Log follows:" cat "$log" } | mail -s "[repo.or.cz] $proj update failed" "$mail",pasky@ucw.cz + fi + touch .banged rm "$log" exit 1 fi @@ -27,3 +31,7 @@ GIT_DIR=. bang git update-server-info date -R >.last_refresh #cat $log rm "$log" +if [ -e .banged ]; then + echo "$proj update succeeded - failure recovery" | mail -s "[repo.or.cz] $proj update succeeded" "$mail",pasky@ucw.cz + rm .banged +fi -- 2.11.4.GIT