Skip to content

Instantly share code, notes, and snippets.

@zetter
Forked from evizitei/default_whenever.rb
Last active December 19, 2015 02:49
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zetter/5885994 to your computer and use it in GitHub Desktop.
Save zetter/5885994 to your computer and use it in GitHub Desktop.
Setup whenever on engineyard for all deployed applications that have the whenever gem bundled on the util instance called 'util'
#
# Cookbook Name:: whenever
# Recipe:: default
#
# for the until instance named 'util'
if node[:name] == 'util'
ey_cloud_report "whenever" do
message "Starting whenever recipe"
end
app_names = node[:applications].keys
local_user = node[:users].first
app_names.each do |app_name|
execute "setting whenever for #{app_name}" do
cwd "/data/#{app_name}/current"
user local_user[:username]
command "bundle exec whenever --update-crontab '#{app_name}_#{node[:environment][:framework_env]}'"
action :run
only_if { ::File.exists?("/data/#{app_name}/current/ey_bundler_binstubs/whenever")}
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