]> gitweb.fluxo.info Git - puppet-apt.git/commitdiff
Allow running cron-apt more than once a day.
authorintrigeri <intrigeri@boum.org>
Sat, 11 Dec 2010 14:08:17 +0000 (15:08 +0100)
committerintrigeri <intrigeri@boum.org>
Sat, 11 Dec 2010 14:17:41 +0000 (15:17 +0100)
README
manifests/cron/base.pp

diff --git a/README b/README
index a84b510910febb009258b529f1d731d82d765da2..88eef47d46d7bcff6ec0f75c7ab50f850bdd74de 100644 (file)
--- a/README
+++ b/README
@@ -186,12 +186,24 @@ apt::cron::download
 This class sets up cron-apt so that it downloads upgradable packages, does not
 actually do any upgrade and emails when the output changes.
 
+cron-apt defaults to run at 4 AM. You may want to set the
+$apt_cron_hours variable before you include the class: its value will
+be passed as the "hours" parameter of a cronjob. Example:
+
+ # Run cron-apt every three hours
+ $apt_cron_hours = "*/3"
+
+Note that the default 4 AM cronjob won't be disabled.
+
 apt::cron::dist-upgrade
 -----------------------
 
 This class sets up cron-apt so that it dist-upgrades the system and
 emails when upgrades are performed.
 
+See apt::cron::download above if you need to run cron-apt more often
+than once a day.
+
 apt::dselect
 ------------
 
index de55772b4c49bba019dbf82c0bdfa5456976ba77..7ccfce644e92956b285a46c187ec20ddc9430ddb 100644 (file)
@@ -1,4 +1,20 @@
 class apt::cron::base {
 
   package { cron-apt: ensure => installed }
+
+  case $apt_cron_hours {
+    '': {}
+    default: {
+      # cron-apt defaults to run every night at 4 o'clock
+      # so we try not to run at the same time.
+      cron { 'apt_cron_every_N_hours':
+        command => 'test -x /usr/sbin/cron-apt && /usr/sbin/cron-apt',
+        user    => root,
+        hour    => "${apt_cron_hours}",
+        minute  => 10,
+        require => Package['cron-apt'],
+      }
+    }
+  }
+
 }