From 46865a0ad7166345deabec6c636077e3b5e49179 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bauer?= Date: Tue, 21 Nov 2017 18:50:45 +0100 Subject: [PATCH] changed backup delete check --- containers/zammad-postgresql/backup.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/containers/zammad-postgresql/backup.sh b/containers/zammad-postgresql/backup.sh index 962730e..280d38b 100644 --- a/containers/zammad-postgresql/backup.sh +++ b/containers/zammad-postgresql/backup.sh @@ -16,7 +16,9 @@ function zammad_backup { echo "${TIMESTAMP} - backuping zammad..." # delete old backups - test -d ${BACKUP_DIR} && find ${BACKUP_DIR}/*_zammad_*.gz -type f -mtime +${HOLD_DAYS} -exec rm {} \; || true + if [ -d "${BACKUP_DIR}" ] && [ -n "$(ls ${BACKUP_DIR})" ]; then + find ${BACKUP_DIR}/*_zammad_*.gz -type f -mtime +${HOLD_DAYS} -exec rm {} \; + fi # tar files tar -czf ${BACKUP_DIR}/${TIMESTAMP}_zammad_files.tar.gz ${ZAMMAD_DIR}