I have several jobs which i would like to submit in a certain order.
First, multiple jobs like cal1st_1.sh cal1st_2.sh ... cal1st_10.sh are submitted at one time and processed simultaneously. After all of them are finished, i have a job called post_process.sh. Then, multiple jobs like cal2nd_1.sh, cal2nd_2.sh .... cal2nd_10.sh, then post_process.sh again, I need to do this for four times.
I tried to write a script get_final.sh like
#!/bin/bash
./cal1st_1.sh & ./cal1st_2.sh & ./cal1st_3.sh...... & ./cal1st_10.sh
./post_process.sh
./cal2nd_1.sh & ./cal2nd_2.sh & ./cal2nd_3.sh...... & ./cal2nd_10.sh
./post_process.sh
and run it with command: nohup ./get_final.sh &, but it seems doesn't work, sometimes post_process.sh started even cal1st*sh weren't all finished, sometimes cal1st*sh weren't processed simultaneously. Can someone tell me which part of my codes is wrong? If you have any questions related to my codes, please leave a comment.
EDIT
I wrote a script get_final.sh like this, do you think it will work? Should i just execute it with nohup ./get_final.sh &
#!/bin/bash
pre_cal.sh
for i in `seq 1 13`; do
cal_dis_vel_strain_$i.sh &
done
wait
echo 1 > record
./post_cal.sh
...