Execute scripts in Parallel

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)

Thanks in advance.

 
ABC_1.ksh && ABC_2.ksh && ABC_3.ksh

Hi

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 ?

Thanks in advance

yes...

for a test

just execute the below commands

 
echo "I am success" && echo "2nd success" && echo "3rd success"

Use fork

#! /usr/bin/perl -w
use strict;

if (fork) {
    <execute one set of scripts>
}
else {
    <execute another set of scripts>
}

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.

#MS.ksh
nohup ABC_batch.ksh > ABC_batch.log &
nohup XYZ_batch.ksh > XYZ_batch.log &

#ABC_batch.ksh
ABC_1.ksh && ABC_2.ksh && ABC_3.ksh

#XYZ_batch.ksh
XYZ_1.ksh && XYZ_2.ksh && XYZ_3.ksh

I would use this :

/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 .