Skip to content
Snippets Groups Projects
Commit 433e366b authored by Bob Mottram's avatar Bob Mottram
Browse files

Move to postgresql directory when doing backups

parent b972805e
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment