Start bash script with SSH -
i use bash script makes ssh connection other machines , executes scripts (which stored on machine).
- ssh master execute script 1
- ssh master execute script 2
- ssh master execute script 3
- 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
Post a Comment