Ghost backup and restore when database is in the current subdirectory
This commit is contained in:
parent
43516f1144
commit
544385a60c
|
@ -228,14 +228,21 @@ function backup_local_ghost {
|
||||||
GHOST_DOMAIN_NAME=$(get_completion_param "ghost domain")
|
GHOST_DOMAIN_NAME=$(get_completion_param "ghost domain")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
suspend_site ${GHOST_DOMAIN_NAME}
|
||||||
|
systemctl stop ghost
|
||||||
|
|
||||||
ghost_path=/var/www/${GHOST_DOMAIN_NAME}/htdocs/content
|
ghost_path=/var/www/${GHOST_DOMAIN_NAME}/htdocs/content
|
||||||
if [ -d $ghost_path ]; then
|
if [ -d $ghost_path ]; then
|
||||||
suspend_site ${GHOST_DOMAIN_NAME}
|
|
||||||
systemctl stop ghost
|
|
||||||
backup_directory_to_usb $ghost_path ghostcontent
|
backup_directory_to_usb $ghost_path ghostcontent
|
||||||
systemctl start ghost
|
|
||||||
restart_site
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
ghost_path=/var/www/${GHOST_DOMAIN_NAME}/htdocs/current/content
|
||||||
|
if [ -d $ghost_path ]; then
|
||||||
|
backup_directory_to_usb $ghost_path ghostcurrent
|
||||||
|
fi
|
||||||
|
|
||||||
|
systemctl start ghost
|
||||||
|
restart_site
|
||||||
}
|
}
|
||||||
|
|
||||||
function restore_local_ghost {
|
function restore_local_ghost {
|
||||||
|
@ -263,6 +270,22 @@ function restore_local_ghost {
|
||||||
rm -rf $temp_restore_dir
|
rm -rf $temp_restore_dir
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
temp_restore_dir=/root/tempghostcurrent
|
||||||
|
function_check restore_directory_from_usb
|
||||||
|
restore_directory_from_usb $temp_restore_dir ghostcurrent
|
||||||
|
if [ -d $temp_restore_dir ]; then
|
||||||
|
if [ -d $temp_restore_dir/var/www/$GHOST_DOMAIN_NAME/htdocs/current/content ]; then
|
||||||
|
cp -r $temp_restore_dir/var/www/$GHOST_DOMAIN_NAME/htdocs/current/content/* /var/www/$GHOST_DOMAIN_NAME/htdocs/current/content/
|
||||||
|
else
|
||||||
|
if [ ! -d /var/www/$GHOST_DOMAIN_NAME/htdocs/current/content ]; then
|
||||||
|
mkdir -p /var/www/$GHOST_DOMAIN_NAME/htdocs/current/content
|
||||||
|
fi
|
||||||
|
cp -r $temp_restore_dir/* /var/www/$GHOST_DOMAIN_NAME/htdocs/current/content/
|
||||||
|
fi
|
||||||
|
chown -R ghost:ghost /var/www/$GHOST_DOMAIN_NAME/htdocs/current/content
|
||||||
|
rm -rf $temp_restore_dir
|
||||||
|
fi
|
||||||
|
|
||||||
systemctl start ghost
|
systemctl start ghost
|
||||||
restart_site
|
restart_site
|
||||||
fi
|
fi
|
||||||
|
@ -274,15 +297,27 @@ function backup_remote_ghost {
|
||||||
GHOST_DOMAIN_NAME=$(get_completion_param "ghost domain")
|
GHOST_DOMAIN_NAME=$(get_completion_param "ghost domain")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
suspend_site ${GHOST_DOMAIN_NAME}
|
||||||
|
|
||||||
temp_backup_dir=/var/www/${GHOST_DOMAIN_NAME}/htdocs/content
|
temp_backup_dir=/var/www/${GHOST_DOMAIN_NAME}/htdocs/content
|
||||||
if [ -d $temp_backup_dir ]; then
|
if [ -d $temp_backup_dir ]; then
|
||||||
suspend_site ${GHOST_DOMAIN_NAME}
|
|
||||||
backup_directory_to_friend $temp_backup_dir ghostcontent
|
backup_directory_to_friend $temp_backup_dir ghostcontent
|
||||||
restart_site
|
|
||||||
else
|
else
|
||||||
|
restart_site
|
||||||
echo $"Ghost domain specified but not found in /var/www/${GHOST_DOMAIN_NAME}"
|
echo $"Ghost domain specified but not found in /var/www/${GHOST_DOMAIN_NAME}"
|
||||||
exit 2578
|
exit 2578
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
temp_backup_dir=/var/www/${GHOST_DOMAIN_NAME}/htdocs/current/content
|
||||||
|
if [ -d $temp_backup_dir ]; then
|
||||||
|
backup_directory_to_friend $temp_backup_dir ghostcurrent
|
||||||
|
else
|
||||||
|
restart_site
|
||||||
|
echo $"Ghost domain specified but not found in $temp_backup_dir"
|
||||||
|
exit 78353
|
||||||
|
fi
|
||||||
|
|
||||||
|
restart_site
|
||||||
}
|
}
|
||||||
|
|
||||||
function restore_remote_ghost {
|
function restore_remote_ghost {
|
||||||
|
@ -310,6 +345,22 @@ function restore_remote_ghost {
|
||||||
rm -rf $temp_restore_dir
|
rm -rf $temp_restore_dir
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
temp_restore_dir=/root/tempghostcurrent
|
||||||
|
function_check restore_directory_from_friend
|
||||||
|
restore_directory_from_friend $temp_restore_dir ghostcurrent
|
||||||
|
if [ -d $temp_restore_dir ]; then
|
||||||
|
if [ -d $temp_restore_dir/var/www/$GHOST_DOMAIN_NAME/htdocs/current/content ]; then
|
||||||
|
cp -r $temp_restore_dir/var/www/$GHOST_DOMAIN_NAME/htdocs/current/content/* /var/www/$GHOST_DOMAIN_NAME/htdocs/current/content/
|
||||||
|
else
|
||||||
|
if [ ! -d /var/www/$GHOST_DOMAIN_NAME/htdocs/current/content ]; then
|
||||||
|
mkdir -p /var/www/$GHOST_DOMAIN_NAME/htdocs/current/content
|
||||||
|
fi
|
||||||
|
cp -r $temp_restore_dir/* /var/www/$GHOST_DOMAIN_NAME/htdocs/current/content/
|
||||||
|
fi
|
||||||
|
chown -R ghost: /var/www/$GHOST_DOMAIN_NAME/htdocs
|
||||||
|
rm -rf $temp_restore_dir
|
||||||
|
fi
|
||||||
|
|
||||||
systemctl start ghost
|
systemctl start ghost
|
||||||
restart_site
|
restart_site
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue