Forum OpenACS Q&A: Response to Race condition in starting nsd and postgres

Collapse
Posted by Rich Graves on
Run something like this out of inittab. kill -0 does nothing to the process but it does verify that it exists.
#!/bin/sh
# Wait up to 5 minutes for postgres to start, then whine.
I=0
until kill -0 `cat /var/run/postmaster.pid` >> /dev/null 2>&1
do
  sleep 10
  I=`expr $I + 1`
  test $I == 30 && echo|mail -s "Hmm... we have a problem" houston
  test $I == 31 && exit 1
done
exec nsd -u aolserver ...