Hi
I want to execute few scripts in Parallel. There is a Master Script (MS.ksh) which will call internally all the scripts we need to run in Parallel. Say there are three set of scripts :
ABC_1.ksh --> ABC_2.ksh --> ABC_3.ksh (execute ABC_2 when ABC_1 is successful ; Execute ABC_3 only when ABC_2 is successful)
XYZ_1.ksh --> XYZ_2.ksh --> XYZ_3.ksh(execute XYZ_2 when XYZ_1 is successful ; Execute XYZ_3 only when XYZ_2 is successful)
When I call MS.ksh then it should parallely execute ABC_1.ksh (& subsequent scripts) & XYZ_1.ksh(& subsequent scripts)
Does that command execute ABC_1.ksh first & only if it is successfully executed it will execute ABC_2.ksh & then ABC_3.ksh or all three scripts in parallel ?
If you want to execute the ABC batch concurrently with the XYZ batch you will need to background both processes (nohup .... &). Neither script must ask questions because it will lose terminal context when in background.
These example scripts assume that all the scripts are executable and can be found through $PATH.
/absolute_path/ABC_1.ksh
if [ $? -eq 0 ]; then
/absolute_path/ABC_2.ksh
if [ $? -eq 0 ]; then
/absolute_path/ABC_3.ksh
else
echo "only ABC_1.ksh and ABC_2.ksh were executed"
fi
else
echo "only ABC_1.ksh was executed"
fi
Considering that $? stores the value of the exit status of the last executed script (command) and each script is executed UNsuccesfully when its exit status is other than 0 .