浏览代码

Move to postgresql directory when doing backups

Bob Mottram 7 年前
父节点
当前提交
433e366b17
共有 1 个文件被更改,包括 5 次插入1 次删除
  1. 5
    1
      src/freedombone-utils-backup

+ 5
- 1
src/freedombone-utils-backup 查看文件

13
 # License
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
 # This program is free software: you can redistribute it and/or modify
18
 # This program is free software: you can redistribute it and/or modify
19
 # it under the terms of the GNU Affero General Public License as published by
19
 # it under the terms of the GNU Affero General Public License as published by
255
     else
255
     else
256
         USE_MONGODB=
256
         USE_MONGODB=
257
         USE_POSTGRESQL=
257
         USE_POSTGRESQL=
258
+        cd /etc/postgresql
258
         sudo -u postgres pg_dump ${1} > ${local_database_dir}/${1}.${database_file_extension}
259
         sudo -u postgres pg_dump ${1} > ${local_database_dir}/${1}.${database_file_extension}
259
     fi
260
     fi
260
     if [ -f ${local_database_dir}/${1}.${database_file_extension} ]; then
261
     if [ -f ${local_database_dir}/${1}.${database_file_extension} ]; then
585
     else
586
     else
586
         USE_MONGODB=
587
         USE_MONGODB=
587
         USE_POSTGRESQL=
588
         USE_POSTGRESQL=
589
+        cd /etc/postgresql
588
         sudo -u postgres pg_dump ${1} > ${local_database_dir}/${1}.${database_file_extension}
590
         sudo -u postgres pg_dump ${1} > ${local_database_dir}/${1}.${database_file_extension}
589
     fi
591
     fi
590
 
592
 
701
         else
703
         else
702
             USE_MONGODB=
704
             USE_MONGODB=
703
             USE_POSTGRESQL=
705
             USE_POSTGRESQL=
706
+            cd /etc/postgresql
704
             mysqlsuccess=$(sudo -u postgres pg_restore ${database_file})
707
             mysqlsuccess=$(sudo -u postgres pg_restore ${database_file})
705
         fi
708
         fi
706
         if [ ! "$?" = "0" ]; then
709
         if [ ! "$?" = "0" ]; then
799
         else
802
         else
800
             USE_MONGODB=
803
             USE_MONGODB=
801
             USE_POSTGRESQL=
804
             USE_POSTGRESQL=
805
+            cd /etc/postgresql
802
             mysqlsuccess=$(sudo -u postgres pg_restore $database_file)
806
             mysqlsuccess=$(sudo -u postgres pg_restore $database_file)
803
         fi
807
         fi
804
         if [ ! "$?" = "0" ]; then
808
         if [ ! "$?" = "0" ]; then