-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Thursday 10 June 2004 09:10, Thomas Hallgren wrote:
> I'm writing a small test harness. I have two threads. One that starts
> the postmaster and another that does all the testing and finally stops
> the postmaster with a pg_ctl stop. At present, the second thread starts
> with a sleep sufficient to ensure that the postmaster is running. Is
> there a proper way to test when the postmaster is ready to receive
> commands?
postmaster will not send a signal on its own,
but you can do some kind of busy polling:
# untested bash script
count=0
while true
do
if psql -c '\q' $MY_DATABASE 2>/dev/null
then
break
fi
count=$(($count + 1))
if [ $count > 10 ]
then
echo "Postgres seems not to be working" >&2
exit 1
fi
sleep 1
done
psql $MY_DATABASE
Mit freundlichem Gruß / With kind regards
Holger Klawitter
- --
lists <at> klawitter <dot> de
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)
iD8DBQFAyBlE1Xdt0HKSwgYRAtoKAJ9uWwaSQPyFae+q7bZFP6ovDRcTgwCcD2Dl
FdpLC9FtMsZ7PZtGqfW843g=
=BHoK
-----END PGP SIGNATURE-----