ndenev / mpssh

Mass Parallel SSH
120 stars 21 forks source link

allow execution of local scripts on remote hosts #5

Closed lancelakey closed 9 years ago

lancelakey commented 11 years ago

I'd like to be able to use mpssh to execute the same local bash script on many remote systems.

I was wondering if this feature exists and perhaps I'm doing this wrong. I didn't see this option in the man page. If this feature doesn't exist I'd like to add it as a feature request

Of course if this feature isn't going to be added I'll keep using mpssh to execute individual commands which it's doing quite well.

Thanks.

ndenev commented 11 years ago

Hi,

Executing a local shell script on remote hosts would mean that the script must first be transferred on the remote machine. Not that this is impossible, but for example if mpssh has to scp the file first and then execute it, this will mean that two connections must be made and it can be slower for many hosts.

What I've done in the past was to put the script I want to execute on a central location and then do something like this:

ndenev@localhost:$ mpssh "wget http://script-server.example.com/script.sh && sh ./script.sh"

P.S.: I might try to investigate this using ssh multiplexing, but this would require some significant redesign of mpssh.

ndenev commented 11 years ago

Actually this might be pretty easy to do with ssh's "LocalCommand" directive. I'll investigate that.

ndenev commented 11 years ago

In the SCPasLocalCommand branch you can find a alpha version that tries to scp a given script to remote host and then execute it.