I use this script, run nightly via crontab, on my small pgsql servers.
it runs as the postgres user.
#!/bin/bash
/usr/pgsql-9.3/bin/pg_dumpall --globals-only | gzip >
/home2/backups/pgsql/pgdumpall.globals.`date +\%a`.sql.gz
for db in $(psql -tc "select datname from pg_database where not
datistemplate"); do \
pg_dump -Fc -f
/home2/backups/pgsql/pgdump.$i.$(date +\%a).dump $db
done
this creates a globals-only backup and a seperate backup of each
database, for each day of the week.
--
john r pierce, recycling bits in santa cruz