We are currently applying modifications to these scripts and we need to execute them frequently to check results. The scheduler is a very old fashioned one and the quickest way to simulate an execution is to create a Unix script that execute processes in the same way, which means simulating serial and parallel executions.
Let's think about the following situation:
We want to execute first the script A.sh and then in parallel the scripts B.sh and C.sh and finally the script D.sh.
The following script does the job:
serial_parallel_scripting.sh
./A.sh &
wait
./B.sh &
./C.sh &
wait
./D.sh
The ampersand symbol (&) executes the job in background and the wait command will wait for the script to terminate. The script will first execute the A.sh script and wait for it to end. Later it will execute B.sh and C.sh scripts in parallel. Finally, when both of them terminate, it will execute the D.sh script. ./A.sh &
wait
./B.sh &
./C.sh &
wait
./D.sh
Nessun commento:
Posta un commento