]> arthur.barton.de Git - backup-script.git/blobdiff - bin/backup-script
backup-audit: Use find(1) instead of ls(1) to get more comparable output
[backup-script.git] / bin / backup-script
index 1cf84f957a806aafbeb461a1a663268ab84aaf95..3d3db8512592bf45fd1217afd98b869c67717ead 100755 (executable)
@@ -75,7 +75,7 @@ Usage() {
 }
 
 ErrorMsg () {
-       printf "%s\n" "$@" >&2
+       printf "%s\\n" "$@" >&2
 }
 
 CleanUp() {
@@ -303,7 +303,7 @@ if [ -r "$conf" ]; then
 else
        config_info="${config_info} (not readable, using defaults)"
 fi
-config_info="${config_info},\nusing \"$conf_d\" as configuration directory."
+config_info="${config_info},\\nusing \"$conf_d\" as configuration directory."
 
 while [ $# -gt 0 ]; do
        case "$1" in
@@ -646,7 +646,11 @@ for f in "${sys[@]}"; do
                        && cmd="$cmd ${user}@${system}:$source_root $sys_target/" \
                        || cmd="$cmd $source_root $sys_target/"
        elif [[ "$backup_type" == "scp" ]]; then
-               cmd="scp"
+               # scp writes some warning messages to stderr (like "Connection
+               # to ... closed by remote host."), even when there is no error
+               # and the exit code is 0 ("no error"); therefore we redirect
+               # stderr to stdout to not confuse "mail wrapper scripts" etc.
+               cmd="scp 2>&1"
                [ "$VERBOSE" -eq 0 ] && cmd="$cmd -q"
                for file in $files; do
                        cmd="$cmd ${user}@${system}:$file $sys_target/"