Let Capistrano do the heavy lifting for you. It is designed with repeatability in mind, letting you easily and reliably automate tasks that used to require login after login and a small army of custom shell scripts.
And if you still find it difficult then you have the Webistrano interface for the same.
Sample Recipe for you.
ReplyDeletenamespace :app do
desc "copy the files from deployed folder to document root."
task :copy_config_files, roles => [:app, :db] do
run "yes|cp -a #{current_path}/* #{deploy_to}testing/; chown -R apache.apache #{deploy_to}testing/"
end
end
after 'deploy:symlink', 'app:copy_config_files'