Skip to content
This repository has been archived by the owner on Jan 30, 2024. It is now read-only.

Commit

Permalink
[#67233096] Move cron.daily to 05:**
Browse files Browse the repository at this point in the history
Splay `cron.daily` - the most intensive one which handles backups,
logrotate, rkhunter, etc - across an entire hour at 5AM. The
hourly/weekly/monthly barely do anything so I'm leaving those be.

We did splay this before. But only to 15mins which doesn't give us much room
across 40~ nodes. I'm picking 5AM not necessarily to avoid clashing with IDA
and HMRC, but just so that we have an entire hour to choose from.

This is in order to reduce our concurrent disk IO across all machines. It is
partly by request of Skyscape, who appear to be struggling now that they
have many tenants running Ubuntu which all kick off `cron.daily` at roughly
the same time. But it is beneficial for us regardless of what vendor we are
on.
  • Loading branch information
dcarley committed Mar 14, 2014
1 parent 769e12b commit 6f85186
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions modules/cron/manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
# set the timings of the scheduled tasks at different times
# for each machine, but at predicable times for the various
# schedules. See spec tests for what ranges these equate to.
$hourly_time = fqdn_rand(15) + 1
$daily_time = $hourly_time + 10
$weekly_time = $hourly_time + 25
$monthly_time = $hourly_time + 40
$hourly_min = fqdn_rand(15) + 1
$daily_min = fqdn_rand(59)
$weekly_min = $hourly_min + 25
$monthly_min = $hourly_min + 40
file {'/etc/crontab':
ensure => present,
owner => 'root',
Expand Down
4 changes: 2 additions & 2 deletions modules/cron/spec/classes/cron_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
it 'should set cron.hourly to **:01-**:15' do
should contain_file('/etc/crontab').with_content(/^([1-9]|1[0-5])\s+\*\s+.*cron\.hourly$/)
end
it 'should set cron.daily to 06:11-06:25' do
should contain_file('/etc/crontab').with_content(/^(1[1-9]|2[0-5])\s+6\s+.*cron\.daily \)$/)
it 'should set cron.daily to 05:01-05:59' do
should contain_file('/etc/crontab').with_content(/^([0-9]|[1-5][0-9])\s+5\s+.*cron\.daily \)$/)
end
it 'should set cron.weekly to 06:26-06:40' do
should contain_file('/etc/crontab').with_content(/^(2[6-9]|3[0-9]|40)\s+6\s+.*cron\.weekly \)$/)
Expand Down
8 changes: 4 additions & 4 deletions modules/cron/templates/etc/crontab.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

# m h dom mon dow user command
<%= @hourly_time %> * * * * root cd / && run-parts --report /etc/cron.hourly
<%= @daily_time %> 6 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
<%= @weekly_time %> 6 * * 7 root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
<%= @monthly_time %> 6 1 * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
<%= @hourly_min %> * * * * root cd / && run-parts --report /etc/cron.hourly
<%= @daily_min %> 5 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
<%= @weekly_min %> 6 * * 7 root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
<%= @monthly_min %> 6 1 * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
#

0 comments on commit 6f85186

Please sign in to comment.