#!/bin/bash export PGPASS=/root/.pgpass # restore: # psql -f $database.dump postgres LIST=$(psql -h postgres -U postgres -At -c "select datname from pg_database order by datname;") for d in $LIST do if [ "$d" != "template0" ]; then pg_dump -h postgres -U postgres "$d" | gzip -c > "$d.dump.gz" fi done