Force NFS to refresh attributes (kernel cache).

This commit is contained in:
2026-04-10 10:10:30 +03:00
parent 76e8c2aee2
commit cb44648e72
+5 -1
View File
@@ -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