Created
February 15, 2010 17:13
-
-
Save dstrelau/304800 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace :deploy do | |
namespace :crontab do | |
def update_cmd_for(role) | |
load_file = "config/whenever/#{fetch(:environment)}.#{role}.rb" | |
[ "cd #{fetch(:current_path)} &&", | |
"if [ -f #{load_file} ] ; then", | |
"bin/whenever", | |
"--update-crontab #{fetch(:application)}.#{fetch(:environment)}.#{role}", | |
"--load-file #{load_file}", | |
"--set environment=#{fetch(:environment)}", | |
"; fi" | |
].join(' ') | |
end | |
desc "Update the crontab files by running 'whenever'" | |
task :update do | |
parallel do |session| | |
roles.keys.each do |role| | |
session.when "in?(#{role.inspect})", update_cmd_for(role) | |
end | |
end | |
end | |
end | |
end | |
after "deploy:update", "deploy:crontab:update" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
every 10.minutes do | |
rake "ts:index" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment