Sfoglia il codice sorgente

Backup and restore files containing list of mongodb apps

Bob Mottram 7 anni fa
parent
commit
5acbc67460

+ 4
- 0
src/freedombone-backup-local Vedi File

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

+ 4
- 0
src/freedombone-backup-remote Vedi File

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

+ 11
- 0
src/freedombone-restore-local Vedi File

30
 
30
 
31
 PROJECT_NAME='freedombone'
31
 PROJECT_NAME='freedombone'
32
 COMPLETION_FILE=$HOME/${PROJECT_NAME}-completed.txt
32
 COMPLETION_FILE=$HOME/${PROJECT_NAME}-completed.txt
33
+MONGODB_APPS_FILE=$HOME/.mongodbapps
33
 CONFIGURATION_FILE=$HOME/${PROJECT_NAME}.cfg
34
 CONFIGURATION_FILE=$HOME/${PROJECT_NAME}.cfg
34
 BACKUP_EXTRA_DIRECTORIES=/root/backup-extra-dirs.csv
35
 BACKUP_EXTRA_DIRECTORIES=/root/backup-extra-dirs.csv
35
 
36
 
184
         #    fi
185
         #    fi
185
         #fi
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
         #if [ -f $CONFIGURATION_FILE ]; then
198
         #if [ -f $CONFIGURATION_FILE ]; then
188
         #    # install according to the config file
199
         #    # install according to the config file
189
         #    freedombone -c $CONFIGURATION_FILE
200
         #    freedombone -c $CONFIGURATION_FILE

+ 10
- 0
src/freedombone-restore-remote Vedi File

31
 PROJECT_NAME='freedombone'
31
 PROJECT_NAME='freedombone'
32
 COMPLETION_FILE=$HOME/${PROJECT_NAME}-completed.txt
32
 COMPLETION_FILE=$HOME/${PROJECT_NAME}-completed.txt
33
 CONFIGURATION_FILE=$HOME/${PROJECT_NAME}.cfg
33
 CONFIGURATION_FILE=$HOME/${PROJECT_NAME}.cfg
34
+MONGODB_APPS_FILE=$HOME/.mongodbapps
34
 BACKUP_EXTRA_DIRECTORIES=/root/backup-extra-dirs.csv
35
 BACKUP_EXTRA_DIRECTORIES=/root/backup-extra-dirs.csv
35
 
36
 
36
 export TEXTDOMAIN=${PROJECT_NAME}-restore-remote
37
 export TEXTDOMAIN=${PROJECT_NAME}-restore-remote
172
         #    fi
173
         #    fi
173
         #fi
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
         #if [ -f $CONFIGURATION_FILE ]; then
185
         #if [ -f $CONFIGURATION_FILE ]; then
176
         #    # install according to the config file
186
         #    # install according to the config file
177
         #    freedombone -c $CONFIGURATION_FILE
187
         #    freedombone -c $CONFIGURATION_FILE

+ 1
- 1
src/freedombone-utils-mongodb Vedi File

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