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

master
gutmet 2022-09-19 11:20:50 +02:00
parent c067ed87f9
commit 19db27d6bf
1 changed files with 6 additions and 5 deletions

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"