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
f66914d6
Commit
f66914d6
authored
Aug 11, 2014
by
Joshua Tauberer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
backup: automatically take a full backup when the sum of the increments get very large
parent
b6713d9a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
1 deletion
+10
-1
backup.py
management/backup.py
+10
-1
No files found.
management/backup.py
View file @
f66914d6
...
...
@@ -10,7 +10,7 @@
# 4) The backup directory is compressed into a single file using tar.
# 5) That file is encrypted with a long password stored in backup/secret_key.txt.
import
sys
,
os
,
os
.
path
,
shutil
import
sys
,
os
,
os
.
path
,
shutil
,
glob
from
utils
import
exclusive_process
,
load_environment
,
shell
...
...
@@ -31,6 +31,15 @@ os.makedirs(backup_dir, exist_ok=True)
# will fail.
if
len
(
os
.
listdir
(
backup_duplicity_dir
))
==
0
:
full_backup
=
True
else
:
# When the size of incremental backups exceeds the size of existing
# full backups, take a new full backup. We want to avoid full backups
# because they are costly to synchronize off-site.
full_sz
=
sum
(
os
.
path
.
getsize
(
f
)
for
f
in
glob
.
glob
(
backup_duplicity_dir
+
'/*-full.*'
))
inc_sz
=
sum
(
os
.
path
.
getsize
(
f
)
for
f
in
glob
.
glob
(
backup_duplicity_dir
+
'/*-inc.*'
))
# (n.b. not counting size of new-signatures files because they are relatively small)
if
inc_sz
>
full_sz
*
1.5
:
full_backup
=
True
# Stop services.
shell
(
'check_call'
,
[
"/usr/sbin/service"
,
"dovecot"
,
"stop"
])
...
...
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