Просмотр исходного кода

Backup and restore files containing list of mongodb apps

Bob Mottram 7 лет назад
Родитель
Сommit
5acbc67460

+ 4
- 0
src/freedombone-backup-local Просмотреть файл

@@ -31,6 +31,7 @@
31 31
 PROJECT_NAME='freedombone'
32 32
 COMPLETION_FILE=$HOME/${PROJECT_NAME}-completed.txt
33 33
 CONFIGURATION_FILE=$HOME/${PROJECT_NAME}.cfg
34
+MONGODB_APPS_FILE=$HOME/.mongodbapps
34 35
 BACKUP_EXTRA_DIRECTORIES=/root/backup-extra-dirs.csv
35 36
 ENABLE_BACKUP_VERIFICATION="no"
36 37
 
@@ -296,6 +297,9 @@ function backup_configfiles {
296 297
     if [ -f $BACKUP_EXTRA_DIRECTORIES ]; then
297 298
         cp -f $BACKUP_EXTRA_DIRECTORIES $temp_backup_dir
298 299
     fi
300
+    if [ -f $MONGODB_APPS_FILE ]; then
301
+        cp -f $MONGODB_APPS_FILE $temp_backup_dir
302
+    fi
299 303
     # nginx password hashes
300 304
     if [ -f /etc/nginx/.htpasswd ]; then
301 305
         cp -f /etc/nginx/.htpasswd $temp_backup_dir/htpasswd

+ 4
- 0
src/freedombone-backup-remote Просмотреть файл

@@ -31,6 +31,7 @@
31 31
 PROJECT_NAME='freedombone'
32 32
 COMPLETION_FILE=$HOME/${PROJECT_NAME}-completed.txt
33 33
 CONFIGURATION_FILE=$HOME/${PROJECT_NAME}.cfg
34
+MONGODB_APPS_FILE=$HOME/.mongodbapps
34 35
 BACKUP_EXTRA_DIRECTORIES=/root/backup-extra-dirs.csv
35 36
 ENABLE_VERIFICATION="no"
36 37
 
@@ -142,6 +143,9 @@ function backup_configfiles {
142 143
     if [ -f $BACKUP_EXTRA_DIRECTORIES ]; then
143 144
         cp -f $BACKUP_EXTRA_DIRECTORIES $temp_backup_dir
144 145
     fi
146
+    if [ -f $MONGODB_APPS_FILE ]; then
147
+        cp -f $MONGODB_APPS_FILE $temp_backup_dir
148
+    fi
145 149
     # nginx password hashes
146 150
     if [ -f /etc/nginx/.htpasswd ]; then
147 151
         cp -f /etc/nginx/.htpasswd $temp_backup_dir/htpasswd

+ 11
- 0
src/freedombone-restore-local Просмотреть файл

@@ -30,6 +30,7 @@
30 30
 
31 31
 PROJECT_NAME='freedombone'
32 32
 COMPLETION_FILE=$HOME/${PROJECT_NAME}-completed.txt
33
+MONGODB_APPS_FILE=$HOME/.mongodbapps
33 34
 CONFIGURATION_FILE=$HOME/${PROJECT_NAME}.cfg
34 35
 BACKUP_EXTRA_DIRECTORIES=/root/backup-extra-dirs.csv
35 36
 
@@ -184,6 +185,16 @@ function restore_configfiles {
184 185
         #    fi
185 186
         #fi
186 187
 
188
+        if [ -f $temp_restore_dir$MONGODB_APPS_FILE ]; then
189
+            cp -f $temp_restore_dir$MONGODB_APPS_FILE $MONGODB_APPS_FILE
190
+            if [ ! "$?" = "0" ]; then
191
+                set_user_permissions
192
+                backup_unmount_drive
193
+                rm -rf $temp_restore_dir
194
+                exit 859034853
195
+            fi
196
+        fi
197
+
187 198
         #if [ -f $CONFIGURATION_FILE ]; then
188 199
         #    # install according to the config file
189 200
         #    freedombone -c $CONFIGURATION_FILE

+ 10
- 0
src/freedombone-restore-remote Просмотреть файл

@@ -31,6 +31,7 @@
31 31
 PROJECT_NAME='freedombone'
32 32
 COMPLETION_FILE=$HOME/${PROJECT_NAME}-completed.txt
33 33
 CONFIGURATION_FILE=$HOME/${PROJECT_NAME}.cfg
34
+MONGODB_APPS_FILE=$HOME/.mongodbapps
34 35
 BACKUP_EXTRA_DIRECTORIES=/root/backup-extra-dirs.csv
35 36
 
36 37
 export TEXTDOMAIN=${PROJECT_NAME}-restore-remote
@@ -172,6 +173,15 @@ function restore_configfiles {
172 173
         #    fi
173 174
         #fi
174 175
 
176
+        if [ -f $temp_restore_dir$MONGODB_APPS_FILE ]; then
177
+            cp -f $temp_restore_dir$MONGODB_APPS_FILE $MONGODB_APPS_FILE
178
+            if [ ! "$?" = "0" ]; then
179
+                unmount_drive
180
+                rm -rf $temp_restore_dir
181
+                exit 7835335
182
+            fi
183
+        fi
184
+
175 185
         #if [ -f $CONFIGURATION_FILE ]; then
176 186
         #    # install according to the config file
177 187
         #    freedombone -c $CONFIGURATION_FILE

+ 1
- 1
src/freedombone-utils-mongodb Просмотреть файл

@@ -30,7 +30,7 @@
30 30
 
31 31
 # Set this when calling backup and restore commands
32 32
 USE_MONGODB=
33
-MONGODB_APPS_FILE=/root/.mongodbapps
33
+MONGODB_APPS_FILE=$HOME/.mongodbapps
34 34
 
35 35
 function store_original_mongodb_password {
36 36
     if [ ! -f /root/.mongodboriginal ]; then