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.

16 lines
687 B

#!/bin/bash
su - postgres -c "PGPASSWORD=\"DESTINATION_POSTGRES_PASSWORD\" psql -U postgres -c \"create database DESTINATION_DB_NAME
WITH OWNER = postgres
ENCODING = 'UTF8'
TABLESPACE = pg_default
LC_COLLATE = 'ru_RU.UTF-8'
LC_CTYPE = 'ru_RU.UTF-8'
TEMPLATE = template0
CONNECTION LIMIT = -1;\""
set "PGPASSWORD=DESTINATION_POSTGRES_PASSWORD"
#su - postgres -c "export \"PGPASSWORD=DESTINATION_POSTGRES_PASSWORD\""
#su - postgres -c "pg_restore -j 2 -d DESTINATION_DB_NAME /var/backups/DB_BACKUP"
echo "Restore database"
su - postgres -c "export PGPASSWORD='DESTINATION_POSTGRES_PASSWORD' && pg_restore -j J_RESTORE -d DESTINATION_DB_NAME /var/backups/DB_BACKUP"