mirror of
https://github.com/andsyrovatko/s4k-psql-db-backuper.git
synced 2026-04-21 22:18:52 +02:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ed2e0291e3 |
+5
-1
@@ -4,7 +4,7 @@
|
|||||||
# Description : Backup PostgreSQL database called by cron or manually.
|
# Description : Backup PostgreSQL database called by cron or manually.
|
||||||
# Usage : ./db_backuper
|
# Usage : ./db_backuper
|
||||||
# Author : syr4ok (Andrii Syrovatko)
|
# Author : syr4ok (Andrii Syrovatko)
|
||||||
# Version : 2.1.3r
|
# Version : 2.1.4r
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
|
|
||||||
# Stop script on pipeline errors
|
# Stop script on pipeline errors
|
||||||
@@ -109,6 +109,8 @@ if [ "$IS_LOCAL_BACKUP" = false ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# 3. Check for duplicate directory
|
# 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
|
if [ -d "${DB_DIR}" ]; then
|
||||||
msg="⚠️ DB backup stopped. Today's dir ($DB_DIR) already exists!"
|
msg="⚠️ DB backup stopped. Today's dir ($DB_DIR) already exists!"
|
||||||
echo "$msg" | tee -a "${CACHE_FILE}"
|
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
|
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)
|
# 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
|
if [ -d "${DB_DIR}" ]; then
|
||||||
BACKUP_SUCCESS=true
|
BACKUP_SUCCESS=true
|
||||||
sync
|
sync
|
||||||
|
|||||||
Reference in New Issue
Block a user