mirror of
https://git.lapiole.org/dani/ansible-roles.git
synced 2025-08-04 07:37:20 +02:00
Update to 2021-12-01 19:13
This commit is contained in:
17
roles/unmaintained/bluemind/templates/pre-backup.j2
Normal file
17
roles/unmaintained/bluemind/templates/pre-backup.j2
Normal file
@@ -0,0 +1,17 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -eo pipefail
|
||||
|
||||
DEST=/home/lbkp/bm/pgsql
|
||||
mkdir -p $DEST
|
||||
chown postgres:postgres $DEST
|
||||
chmod 700 $DEST
|
||||
|
||||
for DB in $(su - postgres -c "/bin/psql -d postgres -qtc 'SELECT datname from pg_database' | grep -vP '^\s+?template[01]$'")
|
||||
do
|
||||
su - postgres -c "/bin/pg_dump -Fp -Cc $DB" | /bin/nice -n 10 zstd -c > $DEST/$DB.sql.zst
|
||||
done
|
||||
su - postgres -c "/bin/pg_dumpall --globals-only" | /bin/nice -n 10 zstd -c > $DEST/pg_globals.sql.zst
|
||||
su - postgres -c "/bin/pg_dumpall --schema-only" | /bin/nice -n 10 zstd -c > $DEST/pg_schema.sql.zst
|
||||
|
||||
cp -a /etc/bm/local /home/lbkp/bm/conf
|
Reference in New Issue
Block a user