Initial release: PSQL DB dump NFS backup automation

This commit is contained in:
2026-04-10 10:01:53 +03:00
commit 76e8c2aee2
5 changed files with 367 additions and 0 deletions
+25
View File
@@ -0,0 +1,25 @@
# Configuration for db_backuper.sh
S_HOSTNAME="your_server_hostname" # For reports subjects info (can be any, not just a hostname).
LOCK_FILE="/var/run/db_backuper.lock" # Lockfile location (1 script process per time).
CACHE_FILE="/tmp/db_backuper_cache" # TMP log-file (will be sent as a report).
PSQL_USER="postgres" # PSQL user (which has access to create a dump of DB).
PSQL_PORT="5432" # Default PostgreSQL port.
PSQL_CHECKPOINT="fast" # fast - immediate start (high I/O load) | spread - gradual start (safe for production).
NFS_SERVER_IP="192.168.x.x" # Paste your server IP here.
NFS_SERVER_DIR="/backups/your_path" # Remote server dir path (which will be mounted via script process).
RETENTION_DAYS=5 # How many days dumps are saved.
DEBUG=1 # 0 - WORKING MODE | 1 - DRY-RUN MODE \
# (do not create folders, do not create dumps, do not remove old folders).
# Configuration of paths
IS_LOCAL_BACKUP=false # true - for local dump saves | false - push dumps remotely via NFS.
MNT_POINT="/mnt/db_backups" # Target folder for dumps (local path or NFS mount point).
# DB dump process output view
EXTENDED_BACK_STATUS=true # true - use -P parameter for psql dump (extended output) | false - no extended status.
# Secrets (for mail and telegram reports)
TG_BOT_ID="XXXXXXXXXX:XXXXXXX...XXXXXXXXXXXXXXXXX" # Your BOT token ID.
TG_CHAT_ID="-XXXXXXXXXXXXX" # Your CHAT ID where bot is.
MAIL_SENDER="-aFrom:root@yourdomain.com" # If need type mail sender address.
MAIL_RECEIVER="support@yourdomain.com" # Mail reports receiver.