Add delete-checkpoints mode until borg v1.1.0 is released with automatic checkpoint pruning
parent
353dfd08c6
commit
e627b2b18b
|
|
@ -8,7 +8,7 @@ OPTIONS
|
|||
-c CONFIG_FILE
|
||||
|
||||
MODES
|
||||
init|backup|verify|unlock|exec
|
||||
init|backup|verify|unlock|delete-checkpoints|exec
|
||||
EOF
|
||||
}
|
||||
|
||||
|
|
@ -77,6 +77,14 @@ borg_verify () {
|
|||
${BORG} check "${BORG_CHECK_ARGS[@]}" "${BORG_REPO}"
|
||||
}
|
||||
|
||||
borg_delete_checkpoints () {
|
||||
${BORG} list "${BORG_REPO}" \
|
||||
| { grep .checkpoint || true; } \
|
||||
| cut -d ' ' -f 1 \
|
||||
| xargs -I % -n 1 --no-run-if-empty \
|
||||
${BORG} delete "${BORG_REPO}"::%
|
||||
}
|
||||
|
||||
borg_unlock () {
|
||||
# Use if borgbackup is not shut down cleanly and complains about lock files
|
||||
${BORG} break-lock "${BORG_REPO}"
|
||||
|
|
@ -225,6 +233,8 @@ mkdir -p "${LOCKDIR}"
|
|||
trap 'exit_verify $?' ERR INT TERM
|
||||
borg_verify
|
||||
exit_verify 0
|
||||
elif [[ ${MODE} == "delete-checkpoints" ]]; then
|
||||
borg_delete_checkpoints
|
||||
elif [[ ${MODE} == "unlock" ]]; then
|
||||
borg_unlock
|
||||
elif [[ ${MODE} == "exec" ]]; then
|
||||
|
|
|
|||
Loading…
Reference in New Issue