|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today! |
|
#1
|
|||
|
|||
|
Test if server started correctly
Hello,
I'm using Postgres 8.2 on Solaris and I need to check whether or not the server started correctly in a bash script. The problem I have is that I don't know what is the correct way to check that a postgres startup failed. - The init.d script doesn't set the errno value so I can't get a return value - The pg_ctl wrapper doesn't set the errno value either ! - the postgres binary sets the errno in case of a failure but the problem is that, my script is run by root so I have to su to postgres user: Code:
su postgres -c '/opt/csw/postgresql/bin/postgres -D /var/lib/pgdata >> /var/lib/pgdata/postgresql.log 2>&1' & and in this case, I can't get the return value from the postgres command. What is then the correct way to check that the server started correctly ? Look for the .pid file ? Thanks, Tex |
|
#2
|
|||
|
|||
|
Hello,
I find two solutions. 1- Code:
/etc/init.d/postgres status returns 1 if the server is not running. 2- I could check for the existance of the postmaster.pid file Tex |
|
#3
|
|||
|
|||
|
Quote:
I'm not sure if solution 2. is good, sometimes it may happen that postgres did not stop correctly, you kill it for example and postmaster.pid isin't deleted (students often do that . And the situation is postgres is not working, postmaster.pid exists. |
![]() |
| Viewing: Dev Shed Forums > Databases > PostgreSQL Help > Test if server started correctly |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|