Skip to navigation
How to create an automatic postgresql database backup script
04.04.17
1. create a password file in your useraccount .pgpass like localhost:*:*:foo1:barbar localhost:*:*:foo2:barbar 2. create your backup script: #!/bin/bash time=`date +%d` day=`date +%d` TIMESTAMP=$(date +"%F") BACKUP_DIR="/mnt/bak" mkdir -p "$BACKUP_DIR/postgres/$TIMESTAMP" pg_dump -hlocalhost -U foo1 bar1 | gzip -c > "$BACKUP_DIR/postgres/$TIMESTAMP/bar1.sql.gz" pg_dump -hlocalhost -U foo2 bar2 | gzip -c > "$BACKUP_DIR/postgres/$TIMESTAMP/bar2.sql.gz"
https://luxagraf.net/src/automatic-offsite-postgresql-backups
Reply
Anonymous
Information Epoch 1747230653
Files are bags of bytes.
Home
Notebook
Contact us