export-dumps.sh 282 Bytes
#!/bin/bash

set -ex

touch /tmp/pgpass
chmod 0600 /tmp/pgpass
echo "*:*:*:*:CHANGEME" > /tmp/pgpass
export PGPASSFILE=/tmp/pgpass

ls /workspace
for database in "$@"; do
	pg_dump -w -h ${POSTGRESQL_HOST} -U postgres "$database" | gzip -9v > "/workspace/exports/$database.gz"
done