My requirements are as follows:
- Once the application starts the PostgreSQL service will be started by the application
- Once the application closes the PostgreSQL service will be closed by the application
- … so i will be taking care of the PostgreSQL setup and running the scripts and starting the service etc
How i am doing this at present is:
- when i start PostgreSQL in a new process i am redirecting the
RedirectStandardErrorandRedirectStandardOutput, it is a silent start, user cannot see the command window etc
The problem is,
- When I coded this I looked for message strings and only supported English. In other words, I used to look for the string
successinRedirectStandardOutputbut now we are supporting multiple languages so the comparison fails.
Is there any way i can find out whether PostgreSQL set up was successfully started and PostgreSQL service is running or not?
I am starting PostgreSQL by calling pg_ctl.exe in separate process.
(we are doing something similar)
you star the
Postgresservice by using this batch fileand for [Stopping] the service
where
C:\Program Files\PostgreSQL\9.0\bin\pg_ctl.exeis the location of your installation ofPostgreSQlwhich u can get fromNow on running the Batch file to check if the service is indeed running you can use
this code from Process running
check for
postgres.exeif its running or not.Also 1. checking-if-windows-application-is-running
2. how-can-i-know-if-a-process-is-running