2
0
Fork 0

sh.zio.backup: add backup_dumps()

main
Ducky 2023-08-22 02:49:33 +01:00
parent 47b75833e6
commit 21b2edca77
1 changed files with 17 additions and 3 deletions

View File

@ -96,6 +96,7 @@ function invoke_script() {
export -f backup_dir
export -f die
export -f dumps_dir
export -f forget_backup
export -f get_config_dir
export -f get_dump_dir
@ -156,6 +157,19 @@ function backup_dir() {
fi
}
function backup_dumps() {
service="$1"
service_dumps_dir="/srv/dumps/$host/$service"
backup_dir "$service_dumps_dir"
if [[ $? == 0 ]]; then
rm -rf "$service_dumps_dir"
[[ -z "$(ls -A "/srv/dumps/$host")" ]] && rm -rf "/srv/dumps/$host"
[[ -z "$(ls -A "/srv/dumps")" ]] && rm -rf "/srv/dumps"
fi
}
function forget_backup() {
timeframe="$1"
@ -182,9 +196,9 @@ function prune_backup() {
function get_dump_dir() {
service="$1"
dumps_dir="/srv/dumps/$host/$service/$(date +"%Y%m%d%H%M%S")"
mkdir -p "$dumps_dir"
[[ $? == "0" ]] && echo "$dumps_dir"
specific_dumps_dir="/srv/dumps/$host/$service/$(date +"%Y%m%d%H%M%S")"
mkdir -p "$specific_dumps_dir"
[[ $? == "0" ]] && echo "$specific_dumps_dir"
}
function start_service() {