From f5cd21a7a8a1436f840729b4d319c7cc95eb881d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bauer?= Date: Sun, 12 Feb 2017 18:55:16 +0100 Subject: [PATCH] fix postgresql db restore --- contrib/backup/functions | 6 +++--- contrib/backup/zammad_restore.sh | 2 -- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/contrib/backup/functions b/contrib/backup/functions index 9ed8ec534..e72d31e4a 100644 --- a/contrib/backup/functions +++ b/contrib/backup/functions @@ -42,7 +42,7 @@ function backup_db () { if [ "${DB_ADAPTER}" == "mysql2" ]; then mysqldump --opt --single-transaction -u${DB_USER} -p${DB_PASS} ${DB_NAME} | gzip > ${BACKUP_DIR}/${TIMESTAMP}_zammad_db.mysql.gz elif [ "${DB_ADAPTER}" == "postgresql" ]; then - su -c "pg_dump ${DB_NAME} | gzip > ${BACKUP_DIR}/${TIMESTAMP}_zammad_db.psql.gz" postgres + su -c "pg_dump -c ${DB_NAME} | gzip > ${BACKUP_DIR}/${TIMESTAMP}_zammad_db.psql.gz" postgres else echo "DB ADAPTER not found. if its sqlite backup is already saved in filebackup" fi @@ -147,10 +147,10 @@ function restore_zammad () { if [ "${DB_ADAPTER}" == "postgresql" ]; then echo "# Restoring PostgrSQL DB" - gunzip < ${BACKUP_DIR}/${RESTORE_DB_DATE}_zammad_db.${DB_FILE_EXT}.gz | pg_restore -c ${DB_NAME} + gunzip -ck < ${BACKUP_DIR}/${RESTORE_DB_DATE}_zammad_db.${DB_FILE_EXT}.gz | su -c "psql -d ${DB_NAME}" postgres elif [ "${DB_ADAPTER}" == "mysql2" ]; then echo "# Restoring MySQL DB" - gunzip < ${BACKUP_DIR}/${RESTORE_DB_DATE}_zammad_db.${DB_FILE_EXT}.gz | mysql -u${DB_USER} -p${DB_PASS} ${DB_NAME} + gunzip -ck < ${BACKUP_DIR}/${RESTORE_DB_DATE}_zammad_db.${DB_FILE_EXT}.gz | mysql -u${DB_USER} -p${DB_PASS} ${DB_NAME} fi } diff --git a/contrib/backup/zammad_restore.sh b/contrib/backup/zammad_restore.sh index c0f986b4d..ac04ed7fb 100755 --- a/contrib/backup/zammad_restore.sh +++ b/contrib/backup/zammad_restore.sh @@ -16,8 +16,6 @@ restore_warning "${1}" check_database_config_exists -get_db_credentials - get_restore_dates choose_restore_date "${1}"