Commit 75954ea8 authored by Thomas Gambier's avatar Thomas Gambier Committed by Romain Courteaud

[backupserver] prevent backup from running if previous backup didn't finish

parent ae8dd586
......@@ -6,14 +6,11 @@ extends =
../../component/openssl/buildout.cfg
../../component/nginx/buildout.cfg
../../component/rdiff-backup/buildout.cfg
# ../../component/duplicity/buildout.cfg
# ../../component/git/buildout.cfg
# ../../component/subversion/buildout.cfg
../../component/rsync/buildout.cfg
../../component/openssh/buildout.cfg
../../component/grep/buildout.cfg
../../component/findutils/buildout.cfg
# ../../stack/flask.cfg
../../component/util-linux/buildout.cfg
../../stack/slapos.cfg
../../stack/monitor/buildout.cfg
......@@ -21,15 +18,11 @@ parts =
extra-eggs
monitor-extra-eggs
rdiff-backup
# duplicity
dcron
logrotate
nginx
openssl
# git
# subversion
rsync
# flask-egg
template
template-pullrdiffbackup
template-backup-script
......@@ -75,7 +68,7 @@ mode = 0644
[template-backup-script]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/template-backup-script.sh.in
md5sum = 9af5212c3195972ca4845601420ab7cd
md5sum = 19dbafa190803ecacb99c480195a5294
output = ${buildout:directory}/template-backup-script.sh.in
mode = 0644
......@@ -103,7 +96,7 @@ mode = 0644
[template-update-rss-script]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/template-update-rss.sh.in
md5sum = b73d8b950ddea3fe1843d612d24ddf19
md5sum = b012c04133a18f8e3c0dae5983142c7f
output = ${buildout:directory}/template-update-rss.sh.in
mode = 0644
......
#!${dash-output:dash}
# don't run if rdiff-backup is still running
# in that case, the promise will detect that previous rdiff backup took too long and report an error
${util-linux:location}/bin/flock --nb $${:status_log}.lock true || exit
export HOME=$${directory:home}
# Inform about beginning of backup
......@@ -8,7 +12,8 @@ ${coreutils-output:echo} "Available only if backup succeed." > $${:statistic_log
# set -e
cd $${:datadirectory}
${rdiff-backup-output:rdiff-backup} \
${util-linux:location}/bin/flock $${:status_log}.lock \
${rdiff-backup-output:rdiff-backup} \
$${:exclude_string} \
--include='$${:include}' \
--exclude='**' \
......
......@@ -8,10 +8,10 @@ PYTHON=${buildout:directory}/bin/${extra-eggs:interpreter}
STATUS2RSS=${status2rss:output}
BASENAME=${coreutils-output:basename}
for status in $STATUS_DIR/*
for status in $STATUS_DIR/*.txt
do
NAME=`$BASENAME $status`
$TAIL -n 1 $status | $PYTHON $STATUS2RSS "Backup status $NAME" "https://[$${nginx-configuration:ip}]:$${nginx-configuration:port}/$NAME.rss" > $RSS_DIR/$NAME.rss
done
$TAIL -n 1 $STATUS_DIR/* | $PYTHON $STATUS2RSS "Full backup status $${:global_rss}" "https://[$${nginx-configuration:ip}]:$${nginx-configuration:port}/$${:global_rss}" > $RSS_DIR/$${:global_rss}
$TAIL -n 1 $STATUS_DIR/*.txt | $PYTHON $STATUS2RSS "Full backup status $${:global_rss}" "https://[$${nginx-configuration:ip}]:$${nginx-configuration:port}/$${:global_rss}" > $RSS_DIR/$${:global_rss}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment