-[ "streaming-replicator", "streaming-server" ].each do |name|
- template "/etc/init.d/#{name}" do
- source "streaming.init.erb"
- owner "root"
- group "root"
- mode 0755
- variables :service => name
+## Enable/disable feeds
+
+if node[:planet][:replication] == "enabled"
+ cron_d "users-agreed" do
+ minute "0"
+ hour "7"
+ user "planet"
+ command "/usr/local/bin/users-agreed"
+ mailto "zerebubuth@gmail.com"
+ end
+
+ cron_d "users-deleted" do
+ minute "0"
+ hour "17"
+ user "planet"
+ command "/usr/local/bin/users-deleted"
+ mailto "zerebubuth@gmail.com"
+ end
+
+ cron_d "replication-changesets" do
+ user "planet"
+ command "/usr/local/bin/replicate-changesets /etc/replication/changesets.conf"
+ mailto "zerebubuth@gmail.com"
+ end
+
+ service "replication-minutely.timer" do
+ action [:enable, :start]
+ end
+
+ service "replication-hourly.timer" do
+ action [:enable, :start]
+ end
+
+ service "replication-daily.timer" do
+ action [:enable, :start]
+ end
+else
+ cron_d "users-agreed" do
+ action :delete
+ end
+
+ cron_d "users-deleted" do
+ action :delete
+ end
+
+ cron_d "replication-changesets" do
+ action :delete
+ end
+
+ service "replication-minutely.timer" do
+ action [:stop, :disable]
+ end
+
+ service "replication-hourly.timer" do
+ action [:stop, :disable]