diff --git a/backup.sh b/backup.sh index 5998c037006af97312a37579056553aaa32aec82..e55feaa4d08161934e66eac3e215e7045c16cf11 100755 --- a/backup.sh +++ b/backup.sh @@ -15,8 +15,18 @@ exit_on_fail(){ retrie_on_fail(){ if [ $1 -ne 0 ]; then + keep=$(($BK_KEEP_FULL-1)) + if [ $keep -gt 0 ]; then + run_duplicity remove-all-inc-of-but-n-full $(($BK_KEEP_FULL-1)) --force + else + cat <<EOF | lftp $host + user $user $ftppass + + rm -rf $remotedir/*-inc* + rm -rf $remotedir/*-new-signatures* +EOF + fi backup "cleaned" - run_duplicity remove-all-inc-of-but-n-full $(($BK_KEEP_FULL-1)) --force leave $? fi }