You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
572 B
18 lines
572 B
5 years ago
|
#!/bin/sh
|
||
|
|
||
|
set -e
|
||
|
|
||
|
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 lz4 -c > $DEST/$DB.sql.lz4
|
||
|
done
|
||
|
su - postgres -c "/bin/pg_dumpall --globals-only" | /bin/nice -n 10 lz4 -c > $DEST/pg_globals.sql.lz4
|
||
|
su - postgres -c "/bin/pg_dumpall --schema-only" | /bin/nice -n 10 lz4 -c > $DEST/pg_schema.sql.lz4
|
||
|
|
||
|
cp -a /etc/bm/local /home/lbkp/bm/conf
|