Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mailinabox
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
mailinabox
Commits
69bd137b
Commit
69bd137b
authored
May 11, 2016
by
Marc Schiller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added a pre-backup script to complement post-backup script.
parent
ae8cd4ef
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
3 deletions
+13
-3
backup.py
management/backup.py
+13
-3
No files found.
management/backup.py
View file @
69bd137b
...
...
@@ -2,9 +2,10 @@
# This script performs a backup of all user data:
# 1) System services are stopped.
# 2) An incremental encrypted backup is made using duplicity.
# 3) The stopped services are restarted.
# 4) STORAGE_ROOT/backup/after-backup is executd if it exists.
# 2) STORAGE_ROOT/backup/before-backup is executed if it exists.
# 3) An incremental encrypted backup is made using duplicity.
# 4) The stopped services are restarted.
# 5) STORAGE_ROOT/backup/after-backup is executed if it exists.
import
os
,
os
.
path
,
shutil
,
glob
,
re
,
datetime
,
sys
import
dateutil.parser
,
dateutil
.
relativedelta
,
dateutil
.
tz
...
...
@@ -258,6 +259,15 @@ def perform_backup(full_backup):
service_command
(
"postfix"
,
"stop"
,
quit
=
True
)
service_command
(
"dovecot"
,
"stop"
,
quit
=
True
)
# Execute a pre-backup script that copies files outside the homedir.
# Run as the STORAGE_USER user, not as root. Pass our settings in
# environment variables so the script has access to STORAGE_ROOT.
pre_script
=
os
.
path
.
join
(
backup_root
,
'before-backup'
)
if
os
.
path
.
exists
(
pre_script
):
shell
(
'check_call'
,
[
'su'
,
env
[
'STORAGE_USER'
],
'-c'
,
pre_script
,
config
[
"target"
]],
env
=
env
)
# Run a backup of STORAGE_ROOT (but excluding the backups themselves!).
# --allow-source-mismatch is needed in case the box's hostname is changed
# after the first backup. See #396.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment