ensuring one script finishes before another begins
I have a script (a.sh) from which I run 6 other scripts (a1.sh, a2.sh ... a6.sh). I have each of the other scripts set up to run in the background (i.e. they start with 'nohup' and end with an ampersand) so that they run in parallel, rather than running one after another.
### a.sh
nohup a1.sh &
nohup a2.sh &
nohup a3.sh &
nohup a4.sh &
nohup a5.sh &
nohup a6.sh &
### end of a.sh
I now find that script a3.sh needs to wait to start until script a1.sh has completed. I know that I can create a new script (for example, b.sh) which runs a1.sh & a3.sh, and then I would replace these in a.sh with b.sh.
### a.sh
nohup a2.sh &
nohup a4.sh &
nohup a5.sh &
nohup a6.sh &
nohup b.sh
### end of a.sh
### b.sh
a1.sh
a3.sh
### end of b.sh
But I am wondering if there might be a way to accomplish this without needing another script? Something along the lines of:
### a.sh
nohup begin a1.sh a3.sh end &
nohup a2.sh &
nohup a4.sh &
nohup a5.sh &
nohup a6.sh &
### end of a.sh
Tim
|