diff --git a/ceph/ceph.backup.deb.files.sh b/ceph/ceph.backup.deb.files.sh index 251e753..61a5ead 100755 --- a/ceph/ceph.backup.deb.files.sh +++ b/ceph/ceph.backup.deb.files.sh @@ -23,8 +23,11 @@ if [ "${CEPH_DEB_PKG_FILE}" ]; then mkdir -p -- "${BKP_DIR}" - # If no recent backup of deb files (<7 days), create a new archive - if [ ! "$(find "${BKP_DIR}" -type f -iname "ceph-deb*.tar" -mtime -7)" ]; then + # If no backup of this version already exists, create a new one +EXISTENT_BACKUP_TAR="$(find "${BKP_DIR}" -type f -iname "ceph-deb_${CEPH_VERSION}*")" + if [ "${EXISTENT_BACKUP_TAR}" ]; then + printf '%b\n' "A backup of this version already exists : ${EXISTENT_BACKUP_TAR}" + else printf '%b\n' "Backup of Ceph deb files in version : ${CEPH_VERSION}" tar cf "${BKP_TAR_PATH}" "${CEPH_DEB_DIR}"/*"${CEPH_VERSION}"*.deb > /dev/null 2>&1 fi