13 lines
392 B
Bash
Executable File
13 lines
392 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
set -eu -o pipefail
|
|
|
|
# restore:
|
|
# psql -f $database.dump postgres
|
|
export PATH="/usr/bin/:$PATH"
|
|
LIST=$(lxc-attach -n postgres -- psql -h postgres -U postgres -At -c "select datname from pg_database order by datname;")
|
|
for d in $LIST; do
|
|
[ "$d" == "template0" ] && continue
|
|
lxc-attach -n postgres -- pg_dump -h postgres -U postgres "$d" | gzip -c > "$d.dump.gz"
|
|
done
|