script to check if another script is running and if so, then sleep for sometime and check again

Hi,
I am a unix newbie. I need to write a script to check wheteher another script is still running. If it is, then sleep for 30m and then check again if the script is running. If the script has stopped running then, I need to come out of the loop.
I am using RHEL 5.2

Here is a quick solution

#!/bin/ksh
#set -vx
# # set counter for detecting the script
typeset -i script_count=0

# # set loop count for 24 hours, change as needed
typeset -i loop_count=1440

while (( $script_count > 0 )); do
    typeset -i loop_count=$(expr $loop_count - 1)
    typeset -i script_count=$(ps -ef | grep -c "<script_name>")
    sleep 60
    if (( $loop_count == 0 )); then
      echo "ALERT - script still running after max loop time"
      exit 1
    fi
done
exit 0

You could try a simple script like this:

#!/bin/bash
while [ 1 ]
do
    PID=$(/bin/ps ax |/bin/grep name_of_script.sh |/bin/awk '{print $1}')
    [ -n "$PID" ] && sleep 1800 || break
done

echo "If we are here the script is no longer running!"