Handle errors of the sync steps

This commit is contained in:
Christian Wolf 2024-05-09 15:43:37 +02:00
parent 45b686cf8f
commit 74e6abb81d

View File

@ -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)."