dobackup: collect errors instead of failing, show them at end

This commit is contained in:
gutmet 2022-09-19 11:20:50 +02:00
parent c067ed87f9
commit 19db27d6bf

View File

@ -30,6 +30,9 @@ source $1
timestamp=`date +"%Y%m%d-%H%M"`
dest="$HOME/backups/$name-$timestamp"
errfile="$name-$timestamp.errs"
touch errfile
if [ "$remote" = true ]; then
if [ -z "$sshUserHost" ]; then
@ -48,12 +51,10 @@ eval ${precommand}
for file in $files; do
fullcommand="$command$file $dest"
echo "$fullcommand"
if [ "$remote" = true ]; then
$fullcommand
else
$fullcommand || exit 1
fi
$fullcommand 2>>"$errfile"
done
echo "$postcommand"
eval ${postcommand}
cat "$errfile"