Backup and restore files containing list of mongodb apps

This commit is contained in:
Bob Mottram 2017-11-20 11:15:54 +00:00
parent e500a0de3b
commit 5acbc67460
5 changed files with 30 additions and 1 deletions

View File

@ -31,6 +31,7 @@
PROJECT_NAME='freedombone' PROJECT_NAME='freedombone'
COMPLETION_FILE=$HOME/${PROJECT_NAME}-completed.txt COMPLETION_FILE=$HOME/${PROJECT_NAME}-completed.txt
CONFIGURATION_FILE=$HOME/${PROJECT_NAME}.cfg CONFIGURATION_FILE=$HOME/${PROJECT_NAME}.cfg
MONGODB_APPS_FILE=$HOME/.mongodbapps
BACKUP_EXTRA_DIRECTORIES=/root/backup-extra-dirs.csv BACKUP_EXTRA_DIRECTORIES=/root/backup-extra-dirs.csv
ENABLE_BACKUP_VERIFICATION="no" ENABLE_BACKUP_VERIFICATION="no"
@ -296,6 +297,9 @@ function backup_configfiles {
if [ -f $BACKUP_EXTRA_DIRECTORIES ]; then if [ -f $BACKUP_EXTRA_DIRECTORIES ]; then
cp -f $BACKUP_EXTRA_DIRECTORIES $temp_backup_dir cp -f $BACKUP_EXTRA_DIRECTORIES $temp_backup_dir
fi fi
if [ -f $MONGODB_APPS_FILE ]; then
cp -f $MONGODB_APPS_FILE $temp_backup_dir
fi
# nginx password hashes # nginx password hashes
if [ -f /etc/nginx/.htpasswd ]; then if [ -f /etc/nginx/.htpasswd ]; then
cp -f /etc/nginx/.htpasswd $temp_backup_dir/htpasswd cp -f /etc/nginx/.htpasswd $temp_backup_dir/htpasswd

View File

@ -31,6 +31,7 @@
PROJECT_NAME='freedombone' PROJECT_NAME='freedombone'
COMPLETION_FILE=$HOME/${PROJECT_NAME}-completed.txt COMPLETION_FILE=$HOME/${PROJECT_NAME}-completed.txt
CONFIGURATION_FILE=$HOME/${PROJECT_NAME}.cfg CONFIGURATION_FILE=$HOME/${PROJECT_NAME}.cfg
MONGODB_APPS_FILE=$HOME/.mongodbapps
BACKUP_EXTRA_DIRECTORIES=/root/backup-extra-dirs.csv BACKUP_EXTRA_DIRECTORIES=/root/backup-extra-dirs.csv
ENABLE_VERIFICATION="no" ENABLE_VERIFICATION="no"
@ -142,6 +143,9 @@ function backup_configfiles {
if [ -f $BACKUP_EXTRA_DIRECTORIES ]; then if [ -f $BACKUP_EXTRA_DIRECTORIES ]; then
cp -f $BACKUP_EXTRA_DIRECTORIES $temp_backup_dir cp -f $BACKUP_EXTRA_DIRECTORIES $temp_backup_dir
fi fi
if [ -f $MONGODB_APPS_FILE ]; then
cp -f $MONGODB_APPS_FILE $temp_backup_dir
fi
# nginx password hashes # nginx password hashes
if [ -f /etc/nginx/.htpasswd ]; then if [ -f /etc/nginx/.htpasswd ]; then
cp -f /etc/nginx/.htpasswd $temp_backup_dir/htpasswd cp -f /etc/nginx/.htpasswd $temp_backup_dir/htpasswd

View File

@ -30,6 +30,7 @@
PROJECT_NAME='freedombone' PROJECT_NAME='freedombone'
COMPLETION_FILE=$HOME/${PROJECT_NAME}-completed.txt COMPLETION_FILE=$HOME/${PROJECT_NAME}-completed.txt
MONGODB_APPS_FILE=$HOME/.mongodbapps
CONFIGURATION_FILE=$HOME/${PROJECT_NAME}.cfg CONFIGURATION_FILE=$HOME/${PROJECT_NAME}.cfg
BACKUP_EXTRA_DIRECTORIES=/root/backup-extra-dirs.csv BACKUP_EXTRA_DIRECTORIES=/root/backup-extra-dirs.csv
@ -184,6 +185,16 @@ function restore_configfiles {
# fi # fi
#fi #fi
if [ -f $temp_restore_dir$MONGODB_APPS_FILE ]; then
cp -f $temp_restore_dir$MONGODB_APPS_FILE $MONGODB_APPS_FILE
if [ ! "$?" = "0" ]; then
set_user_permissions
backup_unmount_drive
rm -rf $temp_restore_dir
exit 859034853
fi
fi
#if [ -f $CONFIGURATION_FILE ]; then #if [ -f $CONFIGURATION_FILE ]; then
# # install according to the config file # # install according to the config file
# freedombone -c $CONFIGURATION_FILE # freedombone -c $CONFIGURATION_FILE

View File

@ -31,6 +31,7 @@
PROJECT_NAME='freedombone' PROJECT_NAME='freedombone'
COMPLETION_FILE=$HOME/${PROJECT_NAME}-completed.txt COMPLETION_FILE=$HOME/${PROJECT_NAME}-completed.txt
CONFIGURATION_FILE=$HOME/${PROJECT_NAME}.cfg CONFIGURATION_FILE=$HOME/${PROJECT_NAME}.cfg
MONGODB_APPS_FILE=$HOME/.mongodbapps
BACKUP_EXTRA_DIRECTORIES=/root/backup-extra-dirs.csv BACKUP_EXTRA_DIRECTORIES=/root/backup-extra-dirs.csv
export TEXTDOMAIN=${PROJECT_NAME}-restore-remote export TEXTDOMAIN=${PROJECT_NAME}-restore-remote
@ -172,6 +173,15 @@ function restore_configfiles {
# fi # fi
#fi #fi
if [ -f $temp_restore_dir$MONGODB_APPS_FILE ]; then
cp -f $temp_restore_dir$MONGODB_APPS_FILE $MONGODB_APPS_FILE
if [ ! "$?" = "0" ]; then
unmount_drive
rm -rf $temp_restore_dir
exit 7835335
fi
fi
#if [ -f $CONFIGURATION_FILE ]; then #if [ -f $CONFIGURATION_FILE ]; then
# # install according to the config file # # install according to the config file
# freedombone -c $CONFIGURATION_FILE # freedombone -c $CONFIGURATION_FILE

View File

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