dobackup: collect errors instead of failing, show them at end
This commit is contained in:
parent
c067ed87f9
commit
19db27d6bf
11
dobackup
11
dobackup
|
@ -30,6 +30,9 @@ source $1
|
||||||
|
|
||||||
timestamp=`date +"%Y%m%d-%H%M"`
|
timestamp=`date +"%Y%m%d-%H%M"`
|
||||||
dest="$HOME/backups/$name-$timestamp"
|
dest="$HOME/backups/$name-$timestamp"
|
||||||
|
errfile="$name-$timestamp.errs"
|
||||||
|
|
||||||
|
touch errfile
|
||||||
|
|
||||||
if [ "$remote" = true ]; then
|
if [ "$remote" = true ]; then
|
||||||
if [ -z "$sshUserHost" ]; then
|
if [ -z "$sshUserHost" ]; then
|
||||||
|
@ -48,12 +51,10 @@ eval ${precommand}
|
||||||
for file in $files; do
|
for file in $files; do
|
||||||
fullcommand="$command$file $dest"
|
fullcommand="$command$file $dest"
|
||||||
echo "$fullcommand"
|
echo "$fullcommand"
|
||||||
if [ "$remote" = true ]; then
|
$fullcommand 2>>"$errfile"
|
||||||
$fullcommand
|
|
||||||
else
|
|
||||||
$fullcommand || exit 1
|
|
||||||
fi
|
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "$postcommand"
|
echo "$postcommand"
|
||||||
eval ${postcommand}
|
eval ${postcommand}
|
||||||
|
|
||||||
|
cat "$errfile"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user