aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2010-02-16 11:29:07 -0200
committerSilvio Rhatto <rhatto@riseup.net>2010-02-16 11:29:07 -0200
commitc941a81bd17c39f733edea42a2cd4c75f00fb3b9 (patch)
tree0ea3584e964a6ba1d39263487b82e7904038815d
parent7e2d2d89906b2ef31c330d3f9f0fa9cbedc3b772 (diff)
downloadpuppet-backup-c941a81bd17c39f733edea42a2cd4c75f00fb3b9.tar.gz
puppet-backup-c941a81bd17c39f733edea42a2cd4c75f00fb3b9.tar.bz2
Checking $backup_remote
-rw-r--r--manifests/init.pp12
-rw-r--r--templates/rdiff-check.sh.erb22
2 files changed, 22 insertions, 12 deletions
diff --git a/manifests/init.pp b/manifests/init.pp
index 83489f2..546dcc7 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -21,11 +21,12 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# backup folder
-$backupdir = "/var/backups"
+$backupdir = "/var/backups"
+$backup_remote = "$backupdir/remote"
# for data that's going to be encrypted and signed
$backup_include_unencrypted = [ "/etc", "/var", "/home", ]
-$backup_exclude_unencrypted = [ "$backupdir/remote", "/var/vservers", "$backupdir/duplicity" ]
+$backup_exclude_unencrypted = [ "$backup_remote", "/var/vservers", "$backupdir/duplicity" ]
# for data that were previously encrypted and signed
$backup_include_encrypted = [ "$backupdir/duplicity", ]
@@ -50,6 +51,13 @@ class backup {
ensure => absent,
}
+ file { "$backup_remote":
+ ensure => directory,
+ owner => root,
+ group => root,
+ mode => 0755,
+ }
+
# rdiff-check script
file { "/usr/local/sbin/rdiff-check":
content => template('backup/rdiff-check.sh.erb'),
diff --git a/templates/rdiff-check.sh.erb b/templates/rdiff-check.sh.erb
index bfb9734..1d4fb6b 100644
--- a/templates/rdiff-check.sh.erb
+++ b/templates/rdiff-check.sh.erb
@@ -3,14 +3,16 @@
# Check rdiff backup sets.
#
-BACKUP_FOLDER="<%= backupdir %>/remote"
+BACKUP_FOLDER="<%= backup_remote %>"
-cwd="`pwd`"
-cd $BACKUP_FOLDER
-
-for set in `find -maxdepth 2 -name 'rdiff'`; do
- echo "Checking backup set $set..."
- rdiff-backup --list-increment-sizes $set;
-done
-
-cd $cwd
+if [ -e "$BACKUP_FOLDER" ]; then
+ cwd="`pwd`"
+ cd $BACKUP_FOLDER
+
+ for set in `find -maxdepth 2 -name 'rdiff'`; do
+ echo "Checking backup set $set..."
+ rdiff-backup --list-increment-sizes $set;
+ done
+
+ cd $cwd
+fi