Skip to content

Commit

Permalink
report error count
Browse files Browse the repository at this point in the history
  • Loading branch information
tjluoma committed Jun 10, 2019
1 parent 781b9ef commit 97b0978
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions di-auto.sh
Expand Up @@ -28,6 +28,8 @@ LOG="$HOME/Library/Logs/$NAME.log"
function timestamp { strftime "%Y-%m-%d at %H:%M:%S" "$EPOCHSECONDS" }
function log { echo "$NAME [`timestamp`]: $@" | tee -a "$LOG" }

COUNT=0

# chdir to the directory where this script is found
cd "$0:h"

Expand Down Expand Up @@ -70,7 +72,7 @@ do

[[ "$VERBOSE" == "yes" ]] && log "Running '$i'"

"$i" 2>&1 | tee -a "$LOG"
("$i" 2>&1 | tee -a "$LOG") || ((COUNT++))

else

Expand All @@ -87,7 +89,7 @@ do
fi # neither "di-all.sh nor di-auto.sh"
done

log "Finished at `timestamp`."
log "Finished at `timestamp`. Error count is $COUNT."

echo "Last run was at `timestamp`" >| "$HOME/.di-auto.lastrun.txt"

Expand Down

0 comments on commit 97b0978

Please sign in to comment.