My requirement is to run two scripts simultaneously.
Let say, script1.ksh is running in a loop :
example:
script1.ksh is:
for i in 1 2 3
do
script2.ksh 1 &
#psedu code which is required to write here
# if script 2.ksh is running, execute a script3.ksh (which actually check the status of a table)
# And if script2.ksh still running sleep for 60 seconds and again check the status by script3.ksh
#Means in every 60 seconds scripts3.ksh needs to execute until script2.ksh finishes
#once script2.ksh is not running, go at the for loop to run with next parameter to fire the script2.ksh
# script2.ksh 2 &
done
--
script2.ksh
echo "Script 2 is running, which is actually a long running data processing script and updating the status of a table"
-----
Note: & I tried to run in background to note down the PID ($$) and tried to build the logic but as soon as I execute in background (&), it is not working properly. And if I don't run in background then it waits until script2.ksh finishes and its too late to check the staus that time via status3.ksh.
Hope I am able to explain the complex requirements.
Your help is highly appreciated.
Thanks,
Sumit