File size: 470 Bytes
64aac1f 3565651 031257a 3565651 031257a 64aac1f 3565651 64aac1f 3565651 64aac1f 3565651 64aac1f 031257a 3565651 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
#!/bin/bash
# Use environment variable PGPASSWORD for backup
export PGPASSWORD="$DB_POSTGRESDB_PASSWORD"
# Backup database to a fixed file name, overwriting the previous backup
pg_dump -U "$DB_POSTGRESDB_USER" -d "$DB_POSTGRESDB_DATABASE" -F c -b -v -f "${WORKDIR}/backups/backup.dump"
# Check if backup was successful
if [ $? -eq 0 ]; then
echo "Database backup successful"
else
echo "Database backup failed"
fi
# Clear environment variable
unset PGPASSWORD |