Replace backup script with autorestic
This commit is contained in:
parent
13084e3558
commit
ed51a86935
17 changed files with 180 additions and 224 deletions
roles/backup/files/hooks
15
roles/backup/files/hooks/postgresql
Executable file
15
roles/backup/files/hooks/postgresql
Executable file
|
@ -0,0 +1,15 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
cd "$1"
|
||||
|
||||
postgres_tables=$(sudo -u postgres psql -Atc "SELECT datname FROM pg_database WHERE datistemplate = false;")
|
||||
|
||||
for i in $postgres_tables
|
||||
do
|
||||
printf "dumping %s ..." "$i"
|
||||
sudo -u postgres pg_dump "$i" | gzip >"pg_dump_$i.sql.gz"
|
||||
echo " done"
|
||||
done
|
||||
|
||||
echo "dumping all"
|
||||
sudo -u postgres pg_dumpall | gzip >"pg_dumpall.sql.gz"
|
Loading…
Add table
Add a link
Reference in a new issue