Created
August 29, 2011 20:34
-
-
Save justinko/1179343 to your computer and use it in GitHub Desktop.
Run a rake task in a separate process in your Rails app
This file contains 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
desc 'Execute a task in the background' | |
task :background, :task do |t, args| | |
rake_path = `which rake`.chomp | |
app_path = Dir.pwd | |
cmd = "#{rake_path} #{args.task} --trace --rakefile #{app_path}/Rakefile >> #{app_path}/log/rake.log 2>&1 &" | |
puts 'Executing:' | |
puts " #{cmd}" | |
system cmd | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment