Hi
We use something like this to distribute cron jobs over a specified
time interval:
define cron::interval(
$ensure = present,
$start_hour = undef,
$length = '60', # interval length in minutes
$comment = undef,
$command = undef,
$user = 'root',
){
$minutes_from_start = fqdn_rand($length)
$minutes_remainder = $minutes_from_start % 60
$additional_hours = ( $minutes_from_start - $minutes_remainder ) / 60
# calculate the real values for the cronjob
$cron_hour = ( $start_hour + $additional_hours ) % 24
$cron_minute = $minutes_remainder
cron{$name:
ensure => $ensure,
command => $command,
user => $user,
hour => $cron_hour,
minute => $cron_minute,
}
}
# Use it like this to run puppet
cron::interval{'early_puppet_run':
start_hour => 5,
length => 120,
comment => 'run puppet early in the morning form 5 to 7',
command => '/opt/puppetlabs/bin/puppet agent --test --color false'
}
Regards
Andreas
> -- You received this message because you are subscribed to the
> Google Groups "Puppet Users" group. To unsubscribe from this group
> and stop receiving emails from it, send an email to
>
puppet-users...@googlegroups.com
> <mailto:
puppet-users...@googlegroups.com>. To view this
> discussion on the web visit
>
https://groups.google.com/d/msgid/puppet-users/334cb9f8-24d1-46a0-8307-9f0f3c489c59%40googlegroups.com
>
>
<
https://groups.google.com/d/msgid/puppet-users/334cb9f8-24d1-46a0-8307-9f0f3c489c59%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit
https://groups.google.com/d/optout.