]> gitweb.fluxo.info Git - puppet-backup.git/commitdiff
Adding rsync-check
authorSilvio Rhatto <rhatto@riseup.net>
Wed, 18 Aug 2010 18:53:26 +0000 (15:53 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Wed, 18 Aug 2010 18:53:26 +0000 (15:53 -0300)
manifests/init.pp
templates/rsync-check.sh.erb [new file with mode: 0644]

index 556b0c73102c5fa3271ec487b0d33e185bc308d8..112cdf233c5315615c9374f8ed1a354c7e3a65fb 100644 (file)
@@ -99,6 +99,26 @@ class backup {
     require  => File['/usr/local/sbin/rdiff-check'],
   }
 
+  # rsync-check script
+  file { "/usr/local/sbin/rsync-check":
+    content => template('backup/rsync-check.sh.erb'),
+    owner   => root,
+    group   => root,
+    mode    => 0755,
+    ensure  => present,
+  }
+
+  # check rsync-backups once a week
+  cron { "rsync_check":
+    command  => "/usr/local/sbin/rsync-check",
+    user     => root,
+    hour     => "0",
+    minute   => "0",
+    weekday  => "0",
+    ensure   => present,
+    require  => File['/usr/local/sbin/rsync-check'],
+  }
+
   # we have to keep that until squeeze turns stable
   file { "/usr/share/backupninja/rsync":
     ensure  => present,
diff --git a/templates/rsync-check.sh.erb b/templates/rsync-check.sh.erb
new file mode 100644 (file)
index 0000000..e945b8c
--- /dev/null
@@ -0,0 +1,34 @@
+#!/bin/bash
+#
+# Check rsync backup sets.
+#
+
+BACKUP_FOLDER="<%= backupdir_remote %>"
+
+if [ -e "$BACKUP_FOLDER" ]; then
+  cwd="`pwd`"
+  cd $BACKUP_FOLDER
+  
+  for set in `find -maxdepth 2 -name 'rsync'`; do
+    echo " "
+    echo "Checking backup set $set..."
+    echo "======================================================"
+    echo " "
+
+    # Check rsync metadata
+    for metadata in `find $set -name created`; do
+      echo $metadata
+      cat  $metadata
+    done
+
+    if [ -d "$set/<%= backupdir %>/duplicity" ]; then
+      echo " "
+      echo "Checking duplicity backup found at $set/<%= backupdir %>/duplicity..."
+      echo "======================================================"
+      echo " "
+      duplicity collection-status file:///$BACKUP_FOLDER/$set/<%= backupdir %>/duplicity
+    fi
+  done
+  
+  cd $cwd
+fi