Move to postgresql directory when doing backups

This commit is contained in:
Bob Mottram 2018-01-23 14:58:43 +00:00
parent b972805e67
commit 433e366b17
1 changed files with 5 additions and 1 deletions

View File

@ -13,7 +13,7 @@
# License
# =======
#
# Copyright (C) 2014-2017 Bob Mottram <bob@freedombone.net>
# Copyright (C) 2014-2018 Bob Mottram <bob@freedombone.net>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
@ -255,6 +255,7 @@ function backup_database_local_usb {
else
USE_MONGODB=
USE_POSTGRESQL=
cd /etc/postgresql
sudo -u postgres pg_dump ${1} > ${local_database_dir}/${1}.${database_file_extension}
fi
if [ -f ${local_database_dir}/${1}.${database_file_extension} ]; then
@ -585,6 +586,7 @@ function backup_database_remote {
else
USE_MONGODB=
USE_POSTGRESQL=
cd /etc/postgresql
sudo -u postgres pg_dump ${1} > ${local_database_dir}/${1}.${database_file_extension}
fi
@ -701,6 +703,7 @@ function restore_database_from_friend {
else
USE_MONGODB=
USE_POSTGRESQL=
cd /etc/postgresql
mysqlsuccess=$(sudo -u postgres pg_restore ${database_file})
fi
if [ ! "$?" = "0" ]; then
@ -799,6 +802,7 @@ function restore_database {
else
USE_MONGODB=
USE_POSTGRESQL=
cd /etc/postgresql
mysqlsuccess=$(sudo -u postgres pg_restore $database_file)
fi
if [ ! "$?" = "0" ]; then