Selaa lähdekoodia

Move to postgresql directory when doing backups

Bob Mottram 7 vuotta sitten
vanhempi
commit
433e366b17
1 muutettua tiedostoa jossa 5 lisäystä ja 1 poistoa
  1. 5
    1
      src/freedombone-utils-backup

+ 5
- 1
src/freedombone-utils-backup Näytä tiedosto

@@ -13,7 +13,7 @@
13 13
 # License
14 14
 # =======
15 15
 #
16
-# Copyright (C) 2014-2017 Bob Mottram <bob@freedombone.net>
16
+# Copyright (C) 2014-2018 Bob Mottram <bob@freedombone.net>
17 17
 #
18 18
 # This program is free software: you can redistribute it and/or modify
19 19
 # it under the terms of the GNU Affero General Public License as published by
@@ -255,6 +255,7 @@ function backup_database_local_usb {
255 255
     else
256 256
         USE_MONGODB=
257 257
         USE_POSTGRESQL=
258
+        cd /etc/postgresql
258 259
         sudo -u postgres pg_dump ${1} > ${local_database_dir}/${1}.${database_file_extension}
259 260
     fi
260 261
     if [ -f ${local_database_dir}/${1}.${database_file_extension} ]; then
@@ -585,6 +586,7 @@ function backup_database_remote {
585 586
     else
586 587
         USE_MONGODB=
587 588
         USE_POSTGRESQL=
589
+        cd /etc/postgresql
588 590
         sudo -u postgres pg_dump ${1} > ${local_database_dir}/${1}.${database_file_extension}
589 591
     fi
590 592
 
@@ -701,6 +703,7 @@ function restore_database_from_friend {
701 703
         else
702 704
             USE_MONGODB=
703 705
             USE_POSTGRESQL=
706
+            cd /etc/postgresql
704 707
             mysqlsuccess=$(sudo -u postgres pg_restore ${database_file})
705 708
         fi
706 709
         if [ ! "$?" = "0" ]; then
@@ -799,6 +802,7 @@ function restore_database {
799 802
         else
800 803
             USE_MONGODB=
801 804
             USE_POSTGRESQL=
805
+            cd /etc/postgresql
802 806
             mysqlsuccess=$(sudo -u postgres pg_restore $database_file)
803 807
         fi
804 808
         if [ ! "$?" = "0" ]; then