Start bash script with SSH -


i use bash script makes ssh connection other machines , executes scripts (which stored on machine).

  1. ssh master execute script 1
  2. ssh master execute script 2
  3. ssh master execute script 3
  4. ssh node1 execute script 1 etc..

now question is: execution of script 2 on master start before script 1 (which takes 30 seconds) finished? run @ same time?

this dependent on how bash script on machine (which ssh connection servers) , scripts on servers works.

for example: following commands procedural , not parallelized long scripts 1, 2, , 3 procedural , not fork work background before exiting (i.e. work done when script exits)

ssh master 'script1'  ssh master 'script2'  ssh master 'script3'  

this can simplified

ssh master 'script1; script2; script3'  

you parallelize work forking these scripts background, running scripts 1, 2 , 3 @ same time.

ssh master 'script1 &; script2 &; script3 &'  

again, make sure scripts don't fork work background , exit before work done


Comments

Popular posts from this blog

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -