From: | Holger Klawitter <lists(at)klawitter(dot)de> |
---|---|
To: | Thomas Hallgren <thhal(at)mailblocks(dot)com>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: How to tell when postmaster is ready |
Date: | 2004-06-10 08:18:12 |
Message-ID: | 200406101018.12696.lists@klawitter.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
-----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-----
From | Date | Subject | |
---|---|---|---|
Next Message | James Pharaoh | 2004-06-10 08:28:50 | Transactions and insertion ordering |
Previous Message | spied | 2004-06-10 07:37:20 | VACUUM FULL produce warnings |