Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
freedombone
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Context Sensitive Group
freedombone
Commits
544385a6
Commit
544385a6
authored
7 years ago
by
Bob Mottram
Browse files
Options
Downloads
Patches
Plain Diff
Ghost backup and restore when database is in the current subdirectory
parent
43516f11
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/freedombone-app-ghost
+57
-6
57 additions, 6 deletions
src/freedombone-app-ghost
with
57 additions
and
6 deletions
src/freedombone-app-ghost
+
57
−
6
View file @
544385a6
...
...
@@ -228,14 +228,21 @@ function backup_local_ghost {
GHOST_DOMAIN_NAME
=
$(
get_completion_param
"ghost domain"
)
fi
suspend_site
${
GHOST_DOMAIN_NAME
}
systemctl stop ghost
ghost_path
=
/var/www/
${
GHOST_DOMAIN_NAME
}
/htdocs/content
if
[
-d
$ghost_path
]
;
then
suspend_site
${
GHOST_DOMAIN_NAME
}
systemctl stop ghost
backup_directory_to_usb
$ghost_path
ghostcontent
systemctl start ghost
restart_site
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
{
...
...
@@ -263,6 +270,22 @@ function restore_local_ghost {
rm
-rf
$temp_restore_dir
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
restart_site
fi
...
...
@@ -274,15 +297,27 @@ function backup_remote_ghost {
GHOST_DOMAIN_NAME
=
$(
get_completion_param
"ghost domain"
)
fi
suspend_site
${
GHOST_DOMAIN_NAME
}
temp_backup_dir
=
/var/www/
${
GHOST_DOMAIN_NAME
}
/htdocs/content
if
[
-d
$temp_backup_dir
]
;
then
suspend_site
${
GHOST_DOMAIN_NAME
}
backup_directory_to_friend
$temp_backup_dir
ghostcontent
restart_site
else
restart_site
echo
$"Ghost domain specified but not found in /var/www/
${
GHOST_DOMAIN_NAME
}
"
exit
2578
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
{
...
...
@@ -310,6 +345,22 @@ function restore_remote_ghost {
rm
-rf
$temp_restore_dir
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
restart_site
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment