mirror of
https://github.com/andsyrovatko/s4k-psql-db-backuper.git
synced 2026-04-21 14:08:53 +02:00
Force NFS to refresh attributes (kernel cache).
This commit is contained in:
+5
-1
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user