Re: problem with PG install script on Windows

From: Ashesh Vashi <ashesh(dot)vashi(at)enterprisedb(dot)com>
To: Igor Neyman <ineyman(at)perceptron(dot)com>
Cc: pgsql-general(at)postgresql(dot)org, Dave Page <dpage(at)pgadmin(dot)org>
Subject: Re: problem with PG install script on Windows
Date: 2010-10-13 05:31:56
Message-ID: AANLkTinpbYfrPVh=dqX7Y+YApy90GV_TyF9YqGjDyx54@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi Igor Neyman,

Yeah - I agree with you.
That needs to be changed.

But, I see scope of the improvement in the script, you shared.
That is - what if the service never started, then it will never return from
the script.

We will do the required changes, Thanks for your inputs.

--
Thanks & Regards,

Ashesh Vashi
EnterpriseDB INDIA: Enterprise Postgres Company<http://www.enterprisedb.com>

*http://www.linkedin.com/in/asheshvashi*<http://www.linkedin.com/in/asheshvashi>

On Tue, Oct 12, 2010 at 11:56 PM, Igor Neyman <ineyman(at)perceptron(dot)com>wrote:

> This message is CCed to Dave Page, because his name is found in
> startserver.vbs script discussed later.
>
> I think there is a (minor?) problem with 8.4.5 Windows installer from
> EnterpriseDB (probably othere releases as well - didn't check).
>
> Here is an abstract from the "tail" of my installation log file:
>
> /*********************************************************/
> Starting the database server...
> Executing cscript //NoLogo "C:\VectorDB\installer\server\startserver.vbs"
> PostgreSQL
> Script exit code: 0
>
> Script output:
> Starting PostgreSQL
> Service PostgreSQL started successfully
> startserver.vbs ran to completion
>
> Script stderr:
>
>
> Loading additional SQL modules...
> Executing cscript //NoLogo "C:\VectorDB\installer\server\loadmodules.vbs"
> "postgres" "****" "C:\VectorDB" "C:\VectorDB\data" 5432 "1"
> Script exit code: 2
>
> Script output:
> Installing pl/pgsql in the template1 databases...
> Start DoCmd("C:\VectorDB\bin\psql.exe" -p 5432 -U postgres -c "CREATE
> LANGUAGE plpgsql;" template1)...
> Executing 'C:\Users\vmwin7\AppData\Local\Temp\rad87CE4.bat'...
> psql: FATAL: the database system is starting up
>
> End DoCmd()
> Failed to install pl/pgsql in the 'template1' database
> Installing the adminpack module in the postgres database...
> Start DoCmd("C:\VectorDB\bin\psql.exe" -p 5432 -U postgres -f
> "C:\VectorDB\share\contrib\adminpack.sql" postgres)...
> Executing 'C:\Users\vmwin7\AppData\Local\Temp\rad87CE4.bat'...
> psql: FATAL: the database system is starting up
>
> End DoCmd()
> Failed to install the 'adminpack' module in the 'postgres' database
> loadmodules.vbs ran to completion
>
> Script stderr:
> Program ended with an error exit code
> /*********************************************************/
>
>
> According to this code in startserver.vbs:
>
> /**********************/
> ' Find the service
> Set objService = objWMIService.Get("Win32_Service.Name='" & strServiceName
> & "'")
>
> ' Start it (them)
> If objService.State <> "Running" Then
> WScript.Echo "Starting " & objService.Name
> iRetval = objService.StartService()
> If iRetval = 0 Then
> WScript.Echo "Service " & objService.Name & " started successfully"
> Else
> WScript.Echo "Failed to start the database server (" & iRetVal &
> ")"
> WScript.Quit 1
> End If
> Else
> WScript.Echo "Service " & objService.Name & " is already running"
> End If
> /**********************/
>
> here is what happened on my system:
> 1. startserver.vbs sends a signal to Postgresql service to start: "iRetval
> = objService.StartService()"
> 2. Postgres accepted the signal and set iRetval = 0, but didn't start yet
> (admittedely machine was busy doing something else at the same time)
> 3. VB script assumes that service is started (without actually checking
> it's status) and proceeds trying to connect to PG (while running next
> installation VB script - loadmodules.vbs, according to installation log).
>
> I realize it's a rare situation when machine will be busy with something
> else while installing Postgres.
> But, it still can happen, and "stricter" code could avoid this problem:6
>
>
> /**********************/
> ' Find the service
> Set objService = objWMIService.Get("Win32_Service.Name='" & strServiceName
> & "'")
>
> ' Start it (them)
> If objService.State <> "Running" Then
> WScript.Echo "Starting " & objService.Name
> iRetval = objService.StartService()
> If iRetval = 0 Then
> Do Until objService.State = "Running"
> WScript.Sleep(5000)
> Loop
> WScript.Echo "Service " & objService.Name & " started successfully"
> Else
> WScript.Echo "Failed to start the database server (" & iRetVal &
> ")"
> WScript.Quit 1
> End If
> Else
> WScript.Echo "Service " & objService.Name & " is already running"
> End If
> /**********************/
>
> If it really waits for service to start, checking it's status in a loop.
> Same status check probably needed earlier in the script, where it's trying
> to start dependencies services.
>
>
> oh, and I have to admit that I have zero VB scripting experience, so please
> correct me if my code modification is wrong.
>
> Regards,
> Igor Neyman
>
>
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Alban Hertroys 2010-10-13 06:38:19 Re: are there any method that "Update" command not affect other unrelated indices?
Previous Message Bruce Momjian 2010-10-13 03:28:55 Re: psql copy command - 1 char limitation on delimiter