ndenev / mpssh

Mass Parallel SSH
120 stars 21 forks source link

a good way to copy files to arbitrary paths on target #6

Open baransn opened 11 years ago

baransn commented 11 years ago

I'd like to use mpssh to copy over a file from one location to multiple locations.

I think the -r option you're currently building copies a script and executes it on the target (also very useful), but I'd like to deploy a jar file on each host.

I've explored utilizing ssh's ability to copy over files:

ssh HOST cat < LOCALFILE ">" REMOTEFILE

by doing this: mpssh -f ~/hosts.list cat < LOCALFILE '">" REMOTEFILE'

but it complains of too many arguments. It appears that redirection isn't supported, only one argument is allowed and that must be the command to execute on the remote host.

One workaround would be to use scp/wget from the remote to grab the file hosted in a central location -- but that gets a little ugly. Should there be a separate mpscp program to just focus on remote copy? Should mpssh support copying files to arbitrary locations (an expansion of the -r option)?

Thanks,

ndenev commented 11 years ago

Hi,

As I recently added the -r option, I didn't had much time to clean it up and fix some minor stuff, but soon I hope to have some more spare time and I will also try to add the ability to scp files to arbitrary locations. I might as well create this to be a separate "mpscp" program, but I will think about it. For now the easies way to do this apart from remote scp/wget is probably to disable the exec of the remote file, but this stll will result in 2 ssh connections to each host as currently the scp is executed as a "LocalCommand" before ssh.