From ab487bdc80fedf374b1fe42b5e4ffb93385440fe Mon Sep 17 00:00:00 2001 From: Matthew Saunders Brown Date: Fri, 23 Apr 2021 09:49:36 -0700 Subject: [PATCH] bashup::set-retention_array function fixes --- bashup-backup-files.sh | 3 +-- bashup-backup-mysql.sh | 3 +-- bashup-backup-pdns.sh | 3 +-- bashup-list-backups.sh | 4 +++- bashup.sh | 4 ++-- 5 files changed, 8 insertions(+), 9 deletions(-) diff --git a/bashup-backup-files.sh b/bashup-backup-files.sh index 3f6868c..c80718a 100755 --- a/bashup-backup-files.sh +++ b/bashup-backup-files.sh @@ -7,8 +7,7 @@ # load include file source $(dirname $0)/bashup.sh -bashup::set_existing_backups -bashup::set_retention_array +bashup::set-retention_array # create backup for today if [[ " ${retention_array[@]} " =~ " ${today} " ]]; then diff --git a/bashup-backup-mysql.sh b/bashup-backup-mysql.sh index b1b2a67..deca41b 100755 --- a/bashup-backup-mysql.sh +++ b/bashup-backup-mysql.sh @@ -7,8 +7,7 @@ # load include file source $(dirname $0)/bashup.sh -bashup::set_existing_backups -bashup::set_retention_array +bashup::set-retention_array # create backup for today if [[ " ${retention_array[@]} " =~ " ${today} " ]]; then diff --git a/bashup-backup-pdns.sh b/bashup-backup-pdns.sh index 211a64a..4fa575e 100755 --- a/bashup-backup-pdns.sh +++ b/bashup-backup-pdns.sh @@ -7,8 +7,7 @@ # load include file source $(dirname $0)/bashup.sh -bashup::set_existing_backups -bashup::set_retention_array +bashup::set-retention_array # create backup for today if [[ " ${retention_array[@]} " =~ " ${today} " ]]; then diff --git a/bashup-list-backups.sh b/bashup-list-backups.sh index aaa8188..09f649b 100755 --- a/bashup-list-backups.sh +++ b/bashup-list-backups.sh @@ -92,7 +92,9 @@ if [ ! -z "$backup" ]; then fi else # output list of backups (dates) - ls -1 $backup_storage_dir | grep -v lost+found + for existing_backup in "${existing_backups[@]}"; do + echo $existing_backup + done fi bashup::unmount_storage_dir diff --git a/bashup.sh b/bashup.sh index d2dfa37..5e7f577 100755 --- a/bashup.sh +++ b/bashup.sh @@ -70,9 +70,9 @@ if [[ "$0" == *"-backup-"* ]];then fi fi -function bashup::set_retention_array () { +function bashup::set-retention_array () { - declare -a retention_array + declare -a -g retention_array # set retention days if [ $retention_days -gt 0 ]; then