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
d919518e
Unverified
Commit
d919518e
authored
8 years ago
by
Bob Mottram
Browse files
Options
Downloads
Patches
Plain Diff
Local backup function for blog
parent
f17bdebb
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/freedombone-app-blog
+22
-2
22 additions, 2 deletions
src/freedombone-app-blog
src/freedombone-backup-local
+9
-22
9 additions, 22 deletions
src/freedombone-backup-local
src/freedombone-utils-web
+20
-0
20 additions, 0 deletions
src/freedombone-utils-web
with
51 additions
and
24 deletions
src/freedombone-app-blog
+
22
−
2
View file @
d919518e
...
...
@@ -47,11 +47,31 @@ function upgrade_blog {
}
function
backup_local_blog
{
echo
''
FULLBLOG_DOMAIN_NAME
=
'blog'
if
grep
-q
"Blog domain"
$COMPLETION_FILE
;
then
FULLBLOG_DOMAIN_NAME
=
$(
cat
$COMPLETION_FILE
|
grep
"Blog domain"
|
awk
-F
':'
'{print $2}'
)
fi
source_directory
=
/var/www/
${
FULLBLOG_DOMAIN_NAME
}
/htdocs
if
[
-d
$source_directory
]
;
then
dest_directory
=
blog
echo
$"Backing up
$source_directory
to
$dest_directory
"
function_check suspend_site
suspend_site
${
FULLBLOG_DOMAIN_NAME
}
function_check backup_directory_to_usb
backup_directory_to_usb
$source_directory
$dest_directory
function_check restart_site
restart_site
echo
$"Backup to
$dest_directory
complete"
fi
}
function
backup_remote_blog
{
echo
''
echo
''
}
function
remove_blog
{
...
...
This diff is collapsed.
Click to expand it.
src/freedombone-backup-local
+
9
−
22
View file @
d919518e
...
...
@@ -31,11 +31,18 @@
PROJECT_NAME
=
'freedombone'
COMPLETION_FILE
=
$HOME
/
${
PROJECT_NAME
}
-completed
.txt
BACKUP_EXTRA_DIRECTORIES
=
/root/backup-extra-dirs.csv
ENABLE_VERIFICATION
=
"no"
ENABLE_
BACKUP_
VERIFICATION
=
"no"
export
TEXTDOMAIN
=
${
PROJECT_NAME
}
-backup-local
export
TEXTDOMAINDIR
=
"/usr/share/locale"
# include utils which allow function_check
UTILS_FILES
=
/usr/share/
${
PROJECT_NAME
}
/utils/
${
PROJECT_NAME
}
-utils-
*
for
f
in
$UTILS_FILES
do
source
$f
done
USB_DRIVE
=
/dev/sdb1
USB_MOUNT
=
/mnt/usb
...
...
@@ -63,26 +70,6 @@ if [ -f /root/dbpass ]; then
DATABASE_PASSWORD
=
$(
cat
/root/dbpass
)
fi
function
suspend_site
{
# suspends a given website
if
[[
$ENABLE_VERIFICATION
!=
"yes"
]]
;
then
return
fi
SUSPENDED_SITE
=
"
$1
"
nginx_dissite
$SUSPENDED_SITE
service nginx reload
}
function
restart_site
{
# restarts a given website
if
[
!
$SUSPENDED_SITE
]
;
then
return
fi
nginx_ensite
$SUSPENDED_SITE
service nginx reload
SUSPENDED_SITE
=
}
function
update_domains
{
RSS_READER_DOMAIN_NAME
=
'ttrss'
if
grep
-q
"RSS reader domain"
$COMPLETION_FILE
;
then
...
...
@@ -214,7 +201,7 @@ function backup_directory_to_usb {
fi
obnam force-lock
-r
$USB_MOUNT
/backup/
${
2
}
--encrypt-with
$MY_BACKUP_KEY_ID
${
1
}
obnam backup
-r
$USB_MOUNT
/backup/
${
2
}
--encrypt-with
$MY_BACKUP_KEY_ID
${
1
}
if
[[
$ENABLE_VERIFICATION
==
"yes"
]]
;
then
if
[[
$ENABLE_
BACKUP_
VERIFICATION
==
"yes"
]]
;
then
obnam verify
-r
$USB_MOUNT
/backup/
${
2
}
--encrypt-with
$MY_BACKUP_KEY_ID
${
1
}
if
[
!
"
$?
"
=
"0"
]
;
then
umount
$USB_MOUNT
...
...
This diff is collapsed.
Click to expand it.
src/freedombone-utils-web
+
20
−
0
View file @
d919518e
...
...
@@ -53,6 +53,9 @@ MAX_PHP_MEMORY=64
# logging level for Nginx
WEBSERVER_LOG_LEVEL
=
'warn'
# whether a given site is being suspended during backup
SUSPENDED_SITE
=
# test a domain name to see if it's valid
function
validate_domain_name
{
# count the number of dots in the domain name
...
...
@@ -548,4 +551,21 @@ function install_command_line_browser {
echo
'install_command_line_browser'
>>
$COMPLETION_FILE
}
function
suspend_site
{
# suspends a given website
SUSPENDED_SITE
=
"
$1
"
nginx_dissite
$SUSPENDED_SITE
service nginx reload
}
function
restart_site
{
# restarts a given website
if
[
!
$SUSPENDED_SITE
]
;
then
return
fi
nginx_ensite
$SUSPENDED_SITE
service nginx reload
SUSPENDED_SITE
=
}
# NOTE: deliberately no exit 0
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