diff options
author | Eduardo Pedroni <e.pedroni91@gmail.com> | 2018-04-04 21:23:03 +0200 |
---|---|---|
committer | Eduardo Pedroni <e.pedroni91@gmail.com> | 2018-04-04 21:23:03 +0200 |
commit | 07d357490e554e8af786c3d4d0cb2b74d7793d1d (patch) | |
tree | 547e371194019ba9dc6aa2bc5d9498a0ae2f429b /backup | |
parent | e5a8226936512f4a7c5c5bac5676431b97334d78 (diff) |
Fixed issue with log file, apparently rsync doesn't like it being in quotes
Diffstat (limited to 'backup')
-rwxr-xr-x | backup | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -5,7 +5,7 @@ LOG_DIR="$HOME/rsync_logs" LOG_FILE="$LOG_DIR/$(date --iso-8601).log" -RSYNC_OPTS="-aP --no-owner --delete-during --exclude='lost+found' --log-file='$LOG_FILE'" +RSYNC_OPTS=("-aP" "--no-owner" "--delete-during" "--exclude=\"lost+found\"" "--log-file=$LOG_FILE") if [ $# -lt 2 ]; then echo "Usage: backup <src> <dst>" @@ -32,4 +32,11 @@ if [ ! -d "$LOG_DIR" ]; then fi fi -rsync $RSYNC_OPTS "${1%/}/*" "$2" +echo "$(date)" > "$LOG_FILE" +if [ $? -ne 0 ]; then + echo "Failed to create log file, exiting" + exit 1 +fi + +echo "rsync $RSYNC_OPTS ${1%/}/* $2" >> "$LOG_FILE" +rsync $RSYNC_OPTS ${1%/}/* $2 |