Skip to content
Snippets Groups Projects
cron.pp 916 B
Newer Older
# Change the time that daily cron jobs run, primarily so that log periods will
# be close to calendar days.  Also remove anacron, since we don't use it on
# servers.
Adam Lewenberg's avatar
Adam Lewenberg committed

class base::cron {
  package { 'anacron': ensure => absent }

  if ($::operatingsystem =~ /^(Debian|Ubuntu)$/) {
    $crond = 'cron'
  } 
  elsif ($::operatingsystem =~ /^(CentOS|RedHat)$/) {
    $crond = 'crond'
    if ($::lsbmajdistrelease == '6') {
      package { 
        'cronie-noanacron': ensure => present;
        'cronie-anacron':   ensure => absent;
      }
      
    }
    file { [ '/etc/cron.d/dailyjobs', '/etc/cron.d/0hourly' ]:
      ensure => absent
    }
  }
  else {
    fail "Unknown operatingsystem in base::cron: ${::operatingsystem}"
  }

  service { $crond:
    ensure => running,
    enable => true,
  }
    
  file { '/etc/crontab':
    content => template('base/cron/crontab.erb'),
    notify  => Service[$crond],
Adam Lewenberg's avatar
Adam Lewenberg committed
}