diff --git a/bup-sync-trigger.sh b/bup-sync-trigger.sh index 0fac4af..35f82d8 100755 --- a/bup-sync-trigger.sh +++ b/bup-sync-trigger.sh @@ -136,6 +136,8 @@ fi echo "The backup script is triggered." date +errored= + while read line do echo "Processing line $line" @@ -143,13 +145,26 @@ do then echo "Shipping to call script $line as in dry mode." else - $line + tmp=$(mktemp) + $line 2> "$tmp" && echo "Done" || { + echo "Command failed: $line" + echo "Logs:" + cat "$tmp" + errored=y + } + rm -f "$tmp" fi done <<< $(cat "$repoFile" | grep -v '^#' | sed '/^\W*$/d') echo "All sync scripts have been run." date +if [ -n "$errored" ] +then + echo "An error had happened. Aborting" + exit 1 +fi + if [ -n "$dryRun" ] then echo "Not updating the trigger timestamp. The value would be $(getNextDate)."