2
0
Fork 0

sh.zio.backup: add prune_dumps()

main
Ducky 2023-08-22 03:35:01 +01:00
parent 2ef6caa499
commit 80c201e384
1 changed files with 7 additions and 3 deletions

View File

@ -104,6 +104,7 @@ function invoke_script() {
export -f invoke_restic export -f invoke_restic
export -f podman_exec export -f podman_exec
export -f prune_backup export -f prune_backup
export -f prune_dumps
export -f say export -f say
export -f start_service export -f start_service
export -f stop_service export -f stop_service
@ -164,9 +165,7 @@ function backup_dumps() {
if [[ $? == 0 ]]; then if [[ $? == 0 ]]; then
rm -rf "$service_dumps_dir" rm -rf "$service_dumps_dir"
prune_dumps
[[ -z "$(ls -A "/srv/dumps/$host")" ]] && rm -rf "/srv/dumps/$host"
[[ -z "$(ls -A "/srv/dumps")" ]] && rm -rf "/srv/dumps"
fi fi
} }
@ -194,6 +193,11 @@ function prune_backup() {
--dry-run --dry-run
} }
function prune_dumps() {
[[ -z "$(ls -A "/srv/dumps/$host")" ]] && rm -rf "/srv/dumps/$host"
[[ -z "$(ls -A "/srv/dumps")" ]] && rm -rf "/srv/dumps"
}
function get_dump_dir() { function get_dump_dir() {
service="$1" service="$1"