SSH to multiple hosts at once -


i have script loops through list of hosts, connecting each of them ssh using rsa key, , saving output file on local machine - works correctly. however, commands run on each server take while (~30 minutes) , there 10 servers. run commands in parallel save time, can't seem working. here code (working):

for host in $hosts;     echo "connecting $host"..     ssh -n -t -t $user@$host "/data/reports/formatted_report.sh" done 

how can speed up?

you should add & end of ssh call, run on background.

for host in $hosts;     echo "connecting $host"..     ssh -n -t -t $user@$host "/data/reports/formatted_report.sh" & done 

Comments

Popular posts from this blog

c# - Unity IoC Lifetime per HttpRequest for UserStore -

Change the color of an oval at click in Java AWT -

I am trying to solve the error message 'incompatible ranks 0 and 1 in assignment' in a fortran 95 program. -