Ok, this seems like a rather silly question because of its simplicity, but is there a prescribed methodology for having a given server copy a file to itself in another location? I know the file transfer actions get(), put(), upload(), etc. are used to manage Capistrano <=> server file transfers, but how about a simple copy of a server-local file to itself? I did a simple test like this:
task :test_local_file_copy, :roles => [:app], :only => {:primary => true} do
@source_file = "/tmp/this_copy"
@destination_file = "/tmp/this_copy2"
puts "Running command 'cp #{@source_file} #{@destination_file}'."
run "cp #{@source_file} {@destination_file}", :roles => [:app], :only => {:primary => true}
run "hostname"
end
Which as expected gave me the following output (no errors):
Running command 'cp /tmp/this_copy /tmp/this_copy2'.
However, the file does not exist in /tmp/ as I was hoping. I even threw in a 'hostname' to make sure that run commands were executing on
myserver.mydomain.com (this is a local VM running CentOS 6 that I'm using /etc/hosts to manage ip connectivity to).
I ran the command (copy and paste) manually while logged in as test_user over ssh, and it worked fine. Is there something about Capistrano that requires a different copy methodology?
Details:
ruby 1.8.7 (2012-02-08 patchlevel 358) [universal-darwin12.0]
Capistrano v2.11.2
TIA