X-Git-Url: https://ruderich.org/simon/gitweb/?a=blobdiff_plain;f=bin%2Fsrsync-incremental;h=644b2fef253f9a881026b3afa1fbc4f3b968b2b5;hb=a1b28253ff5324d4b67a3a7bb113dac84e564e06;hp=16aa88a0215f3db4cb4d231bc212bbf3bd783135;hpb=8f71f32aa3e89e59258a90b93c79a7280397e8c5;p=config%2Fdotfiles.git diff --git a/bin/srsync-incremental b/bin/srsync-incremental index 16aa88a..644b2fe 100755 --- a/bin/srsync-incremental +++ b/bin/srsync-incremental @@ -53,4 +53,12 @@ rsync \ --archive --hard-links --numeric-ids --one-file-system \ --link-dest="$dest" \ "$@" current \ -&& mv current "$target" +|| { + # Try to remove "current" without changing the exit code. In case the + # connection failed without transferring any files, we want the next + # backup to be able to run. + code=$? + rmdir current 2>/dev/null || true + exit $code +} +mv current "$target"