Simple file copy issues

24 views
Skip to first unread message

Christopher Opena

unread,
Mar 11, 2013, 3:15:48 PM3/11/13
to capis...@googlegroups.com
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

Christopher Opena

unread,
Mar 11, 2013, 3:32:36 PM3/11/13
to capis...@googlegroups.com
Ok, I just realized that I sent this to the list with a gigantic syntax error in my run command (missing a # in front of #{@destination_file}).  My apologies if I wasted anyone's time :/
Reply all
Reply to author
Forward
0 new messages