So, I just wanted to know So, I just wanted to know how 2 or more scripts can be run in parallel. I searched a few places and saw mentions of using the '&' in between the various scripts I have but I would not be sure. So, can anyone provide me ideas how it can be possible or various ways I can initiate the process?
            Asked
            
        
        
            Active
            
        
            Viewed 3,056 times
        
    0
            
            
        - 
                    Welcome to Stack Overflow - nice to have you. Please read [How do I ask a good question?](https://stackoverflow.com/help/how-to-ask) and [How to create a Minimal, Complete, and Verifiable example](https://stackoverflow.com/help/mcve) to help keeping Stack Overflows content on the highest possible level and increase your chances getting an appropriate answer. – sebast26 Jan 24 '18 at 14:52
2 Answers
1
            
            
        Simplest way :
#!/bin/sh
/usr/bin/my-process-1 --args1 &
/usr/bin/my-process-2 --args2 &
/usr/bin/my-process-3 --args3 &
wait
echo all processes complete
Source : https://www.codeword.xyz/2015/09/02/three-ways-to-script-processes-in-parallel/
 
    
    
        Alexandre Beaudet
        
- 2,774
- 2
- 20
- 29
- 
                    So only using the & between the scripts is the way to do it? Thanks – jake elias Jan 24 '18 at 16:37
- 
                    It's the easiest way you got to do it, but you can check in the link for more ways to do it, if the & is a problem ! – Alexandre Beaudet Jan 25 '18 at 15:48
1
            
            
        Using & that put the application in the background.
from the man bash.
If a command is terminated by the control operator &, the shell executes the command in the background in a subshell. The shell does not wait for the command to finish, and the return status is 0.
For example.
Running shell script with shell script you can do like this,
#!/bin/bash
sh ./script1 &
sh ./script2 &
 
    
    
        danglingpointer
        
- 4,708
- 3
- 24
- 42
 
    