Skip to content
Snippets Groups Projects
Commit 388a4c88 authored by Bob Mottram's avatar Bob Mottram
Browse files

Backup the database and content subdirectory for ghost

parent 14efdb6a
No related branches found
No related tags found
No related merge requests found
......@@ -221,12 +221,12 @@ function backup_local_ghost {
GHOST_DOMAIN_NAME=$(get_completion_param "ghost domain")
fi
ghost_path=/var/www/${GHOST_DOMAIN_NAME}/htdocs
ghost_path=/var/www/${GHOST_DOMAIN_NAME}/htdocs/content
if [ -d $ghost_path ]; then
function_check backup_database_to_usb
backup_database_to_usb ghost
backup_directory_to_usb $ghost_path ghost
backup_directory_to_usb $ghost_path ghostcontent
restart_site
fi
}
......@@ -245,6 +245,15 @@ function restore_local_ghost {
function_check restore_database
restore_database ghost ${GHOST_DOMAIN_NAME}
temp_restore_dir=/root/tempghostcontent
function_check restore_directory_from_usb
restore_directory_from_usb $temp_restore_dir ghostcontent
if [ -d $temp_restore_dir ]; then
cp -r $temp_restore_dir/var/www/$GHOST_DOMAIN_NAME/htdocs/content/* /var/www/$GHOST_DOMAIN_NAME/htdocs/content/
chown -R ghost:ghost /var/www/$GHOST_DOMAIN_NAME/htdocs/content
rm -rf $temp_restore_dir
fi
MARIADB_PASSWORD=$(${PROJECT_NAME}-pass -u root -a mariadb)
ghost_config=/var/www/${GHOST_DOMAIN_NAME}/htdocs/config.js
sed -i "s|password :.*|password : '${MARIADB_PASSWORD}',|g" $ghost_config
......@@ -278,11 +287,11 @@ function backup_remote_ghost {
GHOST_DOMAIN_NAME=$(get_completion_param "ghost domain")
fi
temp_backup_dir=/var/www/${GHOST_DOMAIN_NAME}/htdocs
temp_backup_dir=/var/www/${GHOST_DOMAIN_NAME}/htdocs/content
if [ -d $temp_backup_dir ]; then
suspend_site ${GHOST_DOMAIN_NAME}
backup_database_to_friend ghost
backup_directory_to_friend $temp_backup_dir ghost
backup_directory_to_friend $temp_backup_dir ghostcontent
restart_site
else
echo $"Ghost domain specified but not found in /var/www/${GHOST_DOMAIN_NAME}"
......@@ -306,7 +315,16 @@ function restore_remote_ghost {
function_check ghost_create_database
ghost_create_database
restore_database_from_friend ghost ${GHOST_DOMAIN_NAME}
restore_database_from_friend ghost
temp_restore_dir=/root/tempghostcontent
function_check restore_directory_from_friend
restore_directory_from_friend $temp_restore_dir ghostcontent
if [ -d $temp_restore_dir ]; then
cp -r $temp_restore_dir/var/www/$GHOST_DOMAIN_NAME/htdocs/content/* /var/www/$GHOST_DOMAIN_NAME/htdocs/content/
chown -R ghost:ghost /var/www/$GHOST_DOMAIN_NAME/htdocs/content
rm -rf $temp_restore_dir
fi
MARIADB_PASSWORD=$(${PROJECT_NAME}-pass -u root -a mariadb)
ghost_config=/var/www/${GHOST_DOMAIN_NAME}/htdocs/config.js
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment