From 001bec529747e994540cbace860016591a323e33 Mon Sep 17 00:00:00 2001 From: DecaTec Date: Fri, 19 Feb 2021 15:57:09 +0100 Subject: [PATCH 1/1] Optimized cleaning up old backups --- CHANGELOG.md | 5 +++++ NextcloudBackup.sh | 4 ++-- NextcloudRestore.sh | 2 +- setup.sh | 2 +- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 029b3f1..e8d2b5a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## 2.1.1 + +### Backup +- Optimized cleaning up of old backups. + ## 2.1.0 ### General diff --git a/NextcloudBackup.sh b/NextcloudBackup.sh index 5606883..4c735de 100644 --- a/NextcloudBackup.sh +++ b/NextcloudBackup.sh @@ -3,7 +3,7 @@ # # Bash script for creating backups of Nextcloud. # -# Version 2.1.0 +# Version 2.1.1 # # Usage: # - With backup directory specified in the script: ./NextcloudBackup.sh @@ -267,7 +267,7 @@ if [ ${maxNrOfBackups} != 0 ] then nrOfBackups=$(ls -l ${backupMainDir} | grep -c ^d) - if [[ ${nrOfBackups} > ${maxNrOfBackups} ]] + if [ ${nrOfBackups} -gt ${maxNrOfBackups} ] then echo "Removing old backups..." ls -t ${backupMainDir} | tail -$(( nrOfBackups - maxNrOfBackups )) | while read -r dirToRemove; do diff --git a/NextcloudRestore.sh b/NextcloudRestore.sh index 51581be..f12ab49 100644 --- a/NextcloudRestore.sh +++ b/NextcloudRestore.sh @@ -3,7 +3,7 @@ # # Bash script for restoring backups of Nextcloud. # -# Version 2.1.0 +# Version 2.1.1 # # Usage: # - With backup directory specified in the script: ./NextcloudRestore.sh (e.g. ./NextcloudRestore.sh 20170910_132703) diff --git a/setup.sh b/setup.sh index f5f4d1e..3556020 100755 --- a/setup.sh +++ b/setup.sh @@ -3,7 +3,7 @@ # # Bash script an easy setup of NextcloudBackup.sh and NextcloudRestore.sh # -# Version 2.1.0 +# Version 2.1.1 # # Usage: # - call the setup.sh script -- 2.34.1