aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Neukirchen <chneukirchen@gmail.com>2012-12-29 16:55:37 +0100
committerChristian Neukirchen <chneukirchen@gmail.com>2012-12-29 16:55:37 +0100
commit00261037af7161405f06f43abfe5137c3f2a5db2 (patch)
treea95437c79763a7ef7b73283a6140f67adb47ff46
parent76b80c6108d14d17c343624329f948b612d5512d (diff)
downloadrdumpfs-00261037af7161405f06f43abfe5137c3f2a5db2.tar.gz
rdumpfs-00261037af7161405f06f43abfe5137c3f2a5db2.tar.xz
rdumpfs-00261037af7161405f06f43abfe5137c3f2a5db2.zip
set correct --link-dest= when forcing backup update
-rwxr-xr-xrdumpfs4
1 files changed, 3 insertions, 1 deletions
diff --git a/rdumpfs b/rdumpfs
index ec7482e..0407a94 100755
--- a/rdumpfs
+++ b/rdumpfs
@@ -22,7 +22,8 @@ src=("${@:1:$#-1}")
dst=${!#}
now=$(date +%Y%m%d)
-last=$(rsync $dst/ | cut -c44- | grep '^[0-9]*$' | sort -n | tail -1)
+dumps=($(rsync $dst/ | cut -c44- | grep '^[0-9]*$' | sort -nr))
+last=${dumps[0]}
rsync_args=(-aHAX --stats --human-readable
--out-format='%10l %n%L' --log-file-format='%10l %i %n%L'
@@ -37,6 +38,7 @@ fi
if [[ "$last" = "$now" ]]; then
$force || fail "dump $now exists, use -f to overwrite/update."
+ [[ -n "${dumps[1]}" ]] && rsync_args+=(--link-dest=../${dumps[1]})
rsync_args+=(--delete-delay --delete-excluded)
fi