aboutsummaryrefslogtreecommitdiffstats
path: root/modules/rsnapshot
diff options
context:
space:
mode:
authorNicolas Vigier <boklm@mageia.org>2012-09-16 21:14:45 +0000
committerNicolas Vigier <boklm@mageia.org>2012-09-16 21:14:45 +0000
commitc535e518708b0f2a65b77864eb9bdd21c7715c7d (patch)
treed4c77a8e790614851d40be43780cf92ea8f125eb /modules/rsnapshot
parenta6d07f57b22d93c083582f684ea3ab28c4113edf (diff)
downloadpuppet-c535e518708b0f2a65b77864eb9bdd21c7715c7d.tar
puppet-c535e518708b0f2a65b77864eb9bdd21c7715c7d.tar.gz
puppet-c535e518708b0f2a65b77864eb9bdd21c7715c7d.tar.bz2
puppet-c535e518708b0f2a65b77864eb9bdd21c7715c7d.tar.xz
puppet-c535e518708b0f2a65b77864eb9bdd21c7715c7d.zip
add hourly, daily, weekly, monthly cron files
Diffstat (limited to 'modules/rsnapshot')
-rw-r--r--modules/rsnapshot/manifests/init.pp41
-rw-r--r--modules/rsnapshot/templates/cron_file5
2 files changed, 45 insertions, 1 deletions
diff --git a/modules/rsnapshot/manifests/init.pp b/modules/rsnapshot/manifests/init.pp
index 15b54735..2d6cbe00 100644
--- a/modules/rsnapshot/manifests/init.pp
+++ b/modules/rsnapshot/manifests/init.pp
@@ -8,6 +8,23 @@ class rsnapshot {
group => root,
mode => 0700,
}
+
+ @rsnapshot::cron_file { 'hourly': }
+ @rsnapshot::cron_file { 'daily': }
+ @rsnapshot::cron_file { 'weekly': }
+ @rsnapshot::cron_file { 'monthly': }
+ }
+
+ define cron_file($rsnapshot_conf = []) {
+ $filepath = "/tmp/cron.${name}_rsnapshot-backups"
+ $rsnapshot_arg = ${name}
+ file { $filepath:
+ ensure => present,
+ content => template('rsnapshot/cron_file'),
+ owner => root,
+ group => root,
+ mode => 0755,
+ }
}
# - 'backup' is an array of "source destination" to backup
@@ -25,11 +42,33 @@ class rsnapshot {
$weekly_interval = '4',
$monthly_interval = '3'
) {
- file { "${rsnapshot::base::confdir}/${name}.conf":
+ $conffile = "${rsnapshot::base::confdir}/${name}.conf"
+ file { $conffile:
owner => root,
group => root,
mode => 0700,
content => template('rsnapshot/rsnapshot.conf'),
}
+
+ if ($hourly_interval != '0') {
+ Rsnapshot::Cron_file <| title == 'hourly' |> {
+ $rsnapshot_conf +> $conffile,
+ }
+ }
+ if ($daily_interval != '0') {
+ Rsnapshot::Cron_file <| title == 'daily' |> {
+ $rsnapshot_conf +> $conffile,
+ }
+ }
+ if ($dweekly_interval != '0') {
+ Rsnapshot::Cron_file <| title == 'weekly' |> {
+ $rsnapshot_conf +> $conffile,
+ }
+ }
+ if ($monthly_interval != '0') {
+ Rsnapshot::Cron_file <| title == 'monthly' |> {
+ $rsnapshot_conf +> $conffile,
+ }
+ }
}
}
diff --git a/modules/rsnapshot/templates/cron_file b/modules/rsnapshot/templates/cron_file
new file mode 100644
index 00000000..43ca9e1b
--- /dev/null
+++ b/modules/rsnapshot/templates/cron_file
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+<%- for conf in @rsnapshot_conf -%>
+/usr/bin/rsnapshot -c <%= conf %> <%= rsnapshot_arg %>
+<%- end -%>