Skip to content

Instantly share code, notes, and snippets.

@ZenCocoon
Last active January 11, 2017 14:20
Show Gist options
  • Save ZenCocoon/6256755 to your computer and use it in GitHub Desktop.
Save ZenCocoon/6256755 to your computer and use it in GitHub Desktop.
Whenever Chef Recipe on EY AppCloud
#
# Cookbook Name:: whenever
# Recipe:: default
#
ey_cloud_report "whenever" do
message "starting whenever recipe"
end
if node[:instance_role] == 'solo' ||
(node[:utility_instances].length > 0 && node[:utility_instances][0][:name] == node[:name]) ||
(node[:utility_instances].length == 0 && node[:instance_role] == 'app_master')
node.engineyard.apps.each do |app, data|
execute "whenever" do
cwd "/data/#{app.name}/current"
user node[:users][0][:username]
command "bundle exec whenever --update-crontab '#{app.name}' --set environment=#{node[:environment][:framework_env]}"
action :run
end
end
ey_cloud_report "whenever" do
message "whenever recipe complete"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment