From ed2e0291e3bf0de8fd203071616afe2c3cf63772 Mon Sep 17 00:00:00 2001 From: Andrii Syrovatko Date: Fri, 10 Apr 2026 10:10:30 +0300 Subject: [PATCH] Force NFS to refresh attributes (kernel cache). --- db_backuper.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/db_backuper.sh b/db_backuper.sh index bb63f0a..9fb4a87 100644 --- a/db_backuper.sh +++ b/db_backuper.sh @@ -4,7 +4,7 @@ # Description : Backup PostgreSQL database called by cron or manually. # Usage : ./db_backuper # Author : syr4ok (Andrii Syrovatko) -# Version : 2.1.3r +# Version : 2.1.4r # ============================================================================= # Stop script on pipeline errors @@ -109,6 +109,8 @@ if [ "$IS_LOCAL_BACKUP" = false ]; then fi # 3. Check for duplicate directory +# Force NFS to refresh attributes for the mount point (in case of NFS caching for some time) +ls "${MNT_POINT}" > /dev/null 2>&1 if [ -d "${DB_DIR}" ]; then msg="⚠️ DB backup stopped. Today's dir ($DB_DIR) already exists!" echo "$msg" | tee -a "${CACHE_FILE}" @@ -152,6 +154,8 @@ else if cd /tmp/ && sudo -u "${PSQL_USER}" "${PSQL_COMMAND}" -p "${PSQL_PORT}" -D "${DB_DIR}" --checkpoint="${PSQL_CHECKPOINT}" -Ft -z ${EXT_STATUS_MSG} 2>&1 | tee -a "${CACHE_FILE}"; then # Checking whether the file was actually created (additional security measure) + # Force NFS to refresh attributes for the mount point (in case of NFS caching for some time) + ls "${MNT_POINT}" > /dev/null 2>&1 if [ -d "${DB_DIR}" ]; then BACKUP_SUCCESS=true sync