urbackup-internet-client/scripts/postgres_backup.sh

11 lines
301 B
Bash

#!/usr/bin/env sh
BACKUP_DIR="/backup/database"
echo "Starting to backup postgres database"
mkdir --parents $BACKUP_DIR || exit 1
PGPASSWORD=$PG_PASSWORD pg_dump --host=$PG_HOST --username=$PG_USER $PG_DATABASE > $BACKUP_DIR/$PG_DATABASE.sqldump || exit 1
echo "Postgres database backup finished"