Script to check running of process

Hi,

Can anyone please tell me how to write a shell script to check
whether a process if running or not.... if its still running then wait for sometime and if not then run the next query.

Also, Under my one main script main.sh I have to run 2 scripts simutaneously which take some time to execute.
scripts are like stopAll1.sh and stopAll2.sh
they both will be stopping 2 different processes. as I want them to be run in one go, will it be fine if I run first in background and then second e.g
./stopAll.sh > /dev/null 2>&1 &
stopAll2.sh

Please suggest
Thanks

You may have the following code in your main.sh:

./stopAll1.sh > /dev/null 2>&1 &
./stopAll2.sh > /dev/null 2>&1 &
proc=`ps -ef | awk -vppid=$$ '$3==ppid' | wc -l`
while true; do
	if [ $proc -ne 0 ]; then
		sleep 5
	else
		break
	fi
done

Note: The code is not tested.

Kevintse,

Thank you for the incredible help.