aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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