Hello, first off thanks for resolving my issue with long running  
migrations, heres what I added to the conf file to make it work:

after  'deploy:migrate', 'session:reconnect'
...
namespace :session do
   desc "Force SSH to reconnect"
   task :reconnect do
     teardown_connections_to(sessions.keys)
   end

end

-----------------------
I have another issue with long running tasks - in this case the task  
is started at the end of deployment and since it is so long running I  
wanted to have Cap "kick off" the task and run it in the background.  
Heres what I tried:

     desc "Generate Sitemap file"
     task :generate, :roles => :app do
       run "cd #{release_path} && nohup rake sitemap:generate  
RAILS_ENV=#{rails_env}&"
     end

However, no arrangement of ampersands and 'nohup' would make this  
work. I did see examples online in other blogs etc. but these actually  
never work.

I thought about running the actual rake task from a shell but do not  
like tat solution and would simply like Cap to honor the ampersand to  
run the task in the background.

Has someone been able to run a task in the background - can you show  
me the exact syntax (were using Cap v. 2.5.5)?

FYI Heres what I ended up doing - its an additional set of tasks that  
are run on their own command line:

cap post_deploy:jobs

---------in deploy.rb:
after 'post_deploy:jobs', 'post_deploy:sitemap:generate'
after 'post_deploy:sitemap:generate', 'session:reconnect'
...
# Put post-deploy tasks here. These are not run by the deploy task at  
all
# Typically we do cap <env> post_deploy:jobs to run these (long  
running) tasks
namespace :post_deploy do
   desc "Run Post-Deploy Jobs"
   task :jobs do
     # placeholder - setup your task to be after this one
   end

   # generate first copy - each night at 1AM each machine also re- 
generates this file
   # This should not be used as it takes a long long time - and cap  
doesnt make it easy or possible to run tasks in the background
   namespace :sitemap do
     desc "Generate Sitemap file"
     task :generate, :roles => :app do
       run "cd #{release_path} && rake sitemap:generate  
RAILS_ENV=#{rails_env}"
     end
   end

end
----------

Mike


--~--~---------~--~----~------------~-------~--~----~
* You received this message because you are subscribed to the Google Groups 
"Capistrano" group.
* To post to this group, send email to [email protected]
* To unsubscribe from this group, send email to 
[email protected] For more options, visit this group at 
http://groups.google.com/group/capistrano?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to