I have a script that runs every 15 minutes but sometimes if the box is busy it hangs and the next process will start before the first one is finished creating a snowball effect.
I had recently the same question and found from above that kill -0 is best for my case:
echo "Starting process..." run-process > $OUTPUT & pid=$! echo "Process started pid=$pid" while true; do kill -0 $pid 2> /dev/null || { echo "Process exit detected"; break; } sleep 1 done echo "Done."