From: Tom Hughes Date: Sun, 23 Jun 2013 09:43:44 +0000 (+0100) Subject: Bring subversion backup script under chef control X-Git-Url: https://git.openstreetmap.org./chef.git/commitdiff_plain/000cf40a50bddab6ef1cfdf174e1e1a7ba15773e Bring subversion backup script under chef control --- diff --git a/cookbooks/subversion/recipes/default.rb b/cookbooks/subversion/recipes/default.rb index 1a52b9f42..f9398d8cc 100644 --- a/cookbooks/subversion/recipes/default.rb +++ b/cookbooks/subversion/recipes/default.rb @@ -48,3 +48,10 @@ apache_site site_name do directory repository_directory variables :realm => "Subversion Repository", :password_file => "/etc/apache2/svn.passwd" end + +template "/etc/cron.daily/svn-backup" do + source "backup.cron.erb" + owner "root" + group "root" + mode 0755 +end diff --git a/cookbooks/subversion/templates/default/backup.cron.erb b/cookbooks/subversion/templates/default/backup.cron.erb new file mode 100644 index 000000000..ac3852a1c --- /dev/null +++ b/cookbooks/subversion/templates/default/backup.cron.erb @@ -0,0 +1,16 @@ +#!/bin/sh + +# DO NOT EDIT - This file is being maintained by Chef + +T=$(mktemp -d -t -p /var/tmp svn.XXXXXXXXXX) +D=$(date +%Y-%m-%d) +B=svn-$D.tar.gz + +nice svnadmin hotcopy /var/lib/subversion/repos/openstreetmap $T/svn-$D > /dev/null + +export GZIP="--rsyncable -9" + +nice tar --create --gzip --directory=$T --file=$T/$B svn-$D +nice rsync $T/$B backup::backup + +rm -rf $T