#!/bin/sh

for DB in $(sudo -u postgres psql -t -q -A -c "select datname from pg_catalog.pg_database where not datname like 'template%';")
do
	sudo -u postgres pg_dump $DB | gzip -c -- > ${DB}.sql.gz
done

sudo -u postgres pg_dumpall -g -U postgres | gzip -c -- > pg_dumpall.sql.gz

