Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Joanne Hugé
slapos
Commits
8aa7af94
Commit
8aa7af94
authored
Feb 28, 2014
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add rdiff backup statistics in the RSS feeds.
parent
396a54e2
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
7 deletions
+25
-7
software/backupserver/instance-pullrdiffbackup.cfg.in
software/backupserver/instance-pullrdiffbackup.cfg.in
+3
-0
software/backupserver/software.cfg
software/backupserver/software.cfg
+13
-3
software/backupserver/status2rss.py
software/backupserver/status2rss.py
+3
-2
software/backupserver/template-backup-script.sh.in
software/backupserver/template-backup-script.sh.in
+6
-2
No files found.
software/backupserver/instance-pullrdiffbackup.cfg.in
View file @
8aa7af94
...
...
@@ -23,6 +23,7 @@ crontabs = $${:etc}/crontabs
cronstamps = $${:etc}/cronstamps
backup = $${:srv}/backup
status = $${:srv}/status
statistic = $${:srv}/statistic
backupscript = $${:etc}/backup
www = $${:srv}/www
home = $${:etc}/home
...
...
@@ -111,7 +112,9 @@ include = {{ include_string }}
exclude_string = {{ exclude_string }}
remote_schema = {{ remote_schema }}
status_name = {{ slave_reference }}_status.txt
statistic_name = {{ slave_reference }}_statistic.txt
status_log = $${directory:status}/$${:status_name}
statistic_log = $${directory:statistic}/$${:statistic_name}
[{{ slave_reference }}-backup-crontab-line]
recipe = slapos.recipe.template
...
...
software/backupserver/software.cfg
View file @
8aa7af94
...
...
@@ -12,6 +12,7 @@ extends =
../../component/rsync/buildout.cfg
../../component/dropbear/buildout.cfg
../../component/grep/buildout.cfg
../../component/findutils/buildout.cfg
# ../../stack/flask.cfg
../../stack/slapos.cfg
...
...
@@ -196,7 +197,7 @@ mode = 0644
[template-backup-script]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/template-backup-script.sh.in
md5sum =
8a076962fc4df7f154572543899328e3
md5sum =
3c4ad4b9a1ecef88f35a84ceb84a3ec6
output = ${buildout:directory}/template-backup-script.sh.in
mode = 0644
...
...
@@ -217,7 +218,7 @@ mode = 0644
[status2rss]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/status2rss.py
md5sum =
138c96e0836f2b06414b98ba2643f21c
md5sum =
0cd1cf97b199dd18fc0168c7281890ea
output = ${buildout:directory}/status2rss.py
mode = 0644
...
...
@@ -234,7 +235,7 @@ mode = 0644
[template-pullrdiffbackup]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-pullrdiffbackup.cfg.in
md5sum =
9bf3a34fa41ae6fe57b183293b3ff377
md5sum =
061b98d001b501c9e1beb424e8802d3d
output = ${buildout:directory}/template-pullrdiffbackup.cfg
mode = 0644
...
...
@@ -327,3 +328,12 @@ cliff = 1.4
cmd2 = 0.6.5.1
prettytable = 0.7.2
requests = 1.2.3
cffi = 0.8.1
cryptography = 0.2.1
pyOpenSSL = 0.14
six = 1.5.2
# Required by:
# cffi==0.8.1
pycparser = 2.10
software/backupserver/status2rss.py
View file @
8aa7af94
...
...
@@ -23,11 +23,12 @@ while 1:
if
not
line
:
break
time
,
desc
=
line
.
split
(
','
,
1
)
time
,
statistic
,
desc
=
line
.
split
(
','
,
2
)
rss_item
=
PyRSS2Gen
.
RSSItem
(
title
=
desc
,
description
=
"%s, %s"
%
(
time
,
desc
),
description
=
"<p>%s</p>"
%
"<br/>"
.
join
((
"%s, %s
\
n
<a href='http://www.nongnu.org/rdiff-backup/FAQ.html#statistics'>Lastest statistic</a>
\
n
%s"
%
(
time
,
desc
,
open
(
statistic
).
read
())).
split
(
"
\
n
"
)),
link
=
LINK
,
pubDate
=
datetime
.
datetime
.
fromtimestamp
(
mktime_tz
(
parsedate_tz
(
time
))),
guid
=
PyRSS2Gen
.
Guid
(
base64
.
b64encode
(
"%s, %s"
%
(
time
,
desc
)))
...
...
software/backupserver/template-backup-script.sh.in
View file @
8aa7af94
...
...
@@ -6,9 +6,11 @@ export HOME=$${directory:home}
# Clean status file (no history needed)
${coreutils-output:rm} -f $${:status_log}
${coreutils-output:rm} -f $${:statistic_log}
# Inform about beginning of backup
${coreutils-output:echo} "`${coreutils-output:date} -u`, $${:hostname} backup running" >> $${:status_log}
${coreutils-output:echo} "Available only if backup succeed." >> $${:statistic_log}
# set -e
cd $${:datadirectory}
...
...
@@ -25,9 +27,11 @@ RESULT=$?
${coreutils-output:rm} -f $${:status_log}
if [ $RESULT -eq 0 ]
then
${coreutils-output:echo} "`${coreutils-output:date} -u`, $${:hostname} backup success" >> $${:status_log}
${coreutils-output:echo} "`${coreutils-output:date} -u`,$${:statistic_log},$${:hostname} backup success" >> $${:status_log}
${coreutils-output:rm} -f $${:statistic_log}
${findutils-output:find} rdiff-backup-data/ -name "session_statistic*" | ${coreutils-output:sort} | ${coreutils-output:tail} -n 1 | ${findutils-output:xargs} ${rdiff-backup-output:rdiff-backup} --calculate-average >> $${:statistic_log}
else
${coreutils-output:echo} "`${coreutils-output:date} -u`,
$${:hostname} backup failed" >> $${:status_log}
${coreutils-output:echo} "`${coreutils-output:date} -u`,
$${:statistic_log},
$${:hostname} backup failed" >> $${:status_log}
fi
# python scripts/verify_with_sudo.py ./ $${:connection}:/
...
...
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