Permalink
Browse files

Merge pull request #5 from jschneiderhan/COOK-1291

COOK-1291 changing cron and description to only specify hourly execution.
  • Loading branch information...
2 parents a72407a + 1b9638b commit 124ebd745e01e62d971639f71039a91803af867e @jtimberman jtimberman committed Jul 12, 2012
Showing with 6 additions and 7 deletions.
  1. +4 −1 recipes/ebs_volume.rb
  2. +2 −6 templates/default/chef-solo-database-snapshot.cron.erb
@@ -44,13 +44,15 @@
slave_role = String.new
root_pw = String.new
snapshots_to_keep = String.new
+ snapshot_cron_schedule = "00 * * * *" # default to hourly snapshots
search(:apps) do |app|
if (app["database_master_role"] & node.run_list.roles).length == 1 || (app["database_slave_role"] & node.run_list.roles).length == 1
master_role = app["database_master_role"] & node.run_list.roles
slave_role = app["database_slave_role"] & node.run_list.roles
root_pw = app["mysql_root_password"][node.chef_environment]
snapshots_to_keep = app["snapshots_to_keep"][node.chef_environment]
+ snapshot_cron_schedule = app["snapshot_cron_schedule"][node.chef_environment] if app["snapshot_cron_schedule"] && app["snapshot_cron_schedule"][node.chef_environment]
if (master_role & node.run_list.roles).length == 1
db_type = "master"
@@ -168,7 +170,8 @@
source "chef-solo-database-snapshot.cron.erb"
variables(
:json_attribs => "/etc/chef/chef-solo-database-snapshot.json",
- :config_file => "/etc/chef/chef-solo-database-snapshot.rb"
+ :config_file => "/etc/chef/chef-solo-database-snapshot.rb",
+ :schedule => snapshot_cron_schedule
)
owner "root"
group "root"
@@ -1,10 +1,6 @@
# Managed by Chef
# m h dom mon dow command
-# Keep 1 day of hourly, 7 days of daily, 4 weeks of weekly and 1 year of monthly snapshots
+# Keep 1 day of hourly snapshots
PATH=/usr/sbin:/usr/bin:/sbin:/bin
<% cs = "chef-solo -j #{@json_attribs} -c #{@config_file}" %>
-00 * * * * root <%= cs %>
-15 0 * * * root <%= cs %>
-30 0 * * 0 root <%= cs %>
-45 0 1 * * root <%= cs %>
-
+<%= @schedule %> root <%= cs %>

0 comments on commit 124ebd7

Please sign in to comment.