sequentially run the shell scripts.

Hi All,
I have a master script , which would run 4 scripts in sequence. When the first script gets executed , I need to check if a particular process has been completed. If it is completed , only then proceed with the second script.

This same rule applies to script3 and script4.

Can someone please help me out.This is the function that I wrote for the process check.

process_check ()
{
p1=`ps -ef | grep o1 |grep -v grep| wc -l`
if [ "$p1" = 0]
echo "Process not running"
return 0
else
echo "Process  completed"
return 1
}

Guys,
Please help...

Please don't bump up questions, that's against our rules.

Use the wait command, have a read of the man page of wait.

Regards

You are missing then (as well as a space before ]):

if [ "$p1" = 0 ]
then

And you don't need two greps as well as wc:

if ps -ef | grep '[o]1'
then

Thanks a lot!!