Skip to content

Commit b93af8c

Browse files
committed
Merged branch hotfixes into master
2 parents f0bd1bf + 2ef211d commit b93af8c

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

lgsm/functions/command_backup.sh

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -127,18 +127,20 @@ fn_backup_compression(){
127127
fn_print_ok_nl "Completed: ${backupname}.tar.gz, total size $(du -sh "${backupdir}/${backupname}.tar.gz" | awk '{print $1}')"
128128
fn_script_log_pass "Backup created: ${backupname}.tar.gz, total size $(du -sh "${backupdir}/${backupname}.tar.gz" | awk '{print $1}')"
129129
fi
130+
# Remove lock file
131+
rm -f "${tmpdir}/.backup.lock"
130132
}
131133

132134
# Clear old backups according to maxbackups and maxbackupdays variables
133135
fn_backup_prune(){
134-
# How many backups there are
135-
info_distro.sh
136-
# How many backups exceed maxbackups
137-
backupquotadiff=$((backupcount-maxbackups))
138-
# How many backups exceed maxbackupdays
139-
backupsoudatedcount=$(find "${backupdir}"/ -type f -name "*.tar.gz" -mtime +"${maxbackupdays}"|wc -l)
140-
# If backup variables are set
141-
if [ -n "${maxbackupdays}" ]&&[ -n "${maxbackups}" ]; then
136+
# Clear if backup variables are set
137+
if [ -n "${maxbackups}" ]&&[ -n "${maxbackupdays}" ]; then
138+
# How many backups there are
139+
info_distro.sh
140+
# How many backups exceed maxbackups
141+
backupquotadiff=$((backupcount-maxbackups))
142+
# How many backups exceed maxbackupdays
143+
backupsoudatedcount=$(find "${backupdir}"/ -type f -name "*.tar.gz" -mtime +"${maxbackupdays}"|wc -l)
142144
# If anything can be cleared
143145
if [ "${backupquotadiff}" -gt "0" ]||[ "${backupsoudatedcount}" -gt "0" ]; then
144146
fn_print_dots "Pruning"
@@ -195,8 +197,4 @@ fn_backup_dir
195197
fn_backup_compression
196198
fn_backup_prune
197199
fn_backup_start_server
198-
199-
# Remove lock file
200-
rm -f "${tmpdir}/.backup.lock"
201-
202200
core_exit.sh

0 commit comments

Comments
 (0)