sh.zio.backup: add backup_dumps()
parent
47b75833e6
commit
21b2edca77
|
@ -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() {
|
||||
|
|
Loading…
Reference in New Issue