Search Postgresql Archives

Re: problem with PG install script on Windows

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



 


From: Ashesh Vashi [mailto:ashesh.vashi@xxxxxxxxxxxxxxxx]
Sent: Wednesday, October 13, 2010 1:32 AM
To: Igor Neyman
Cc: pgsql-general@xxxxxxxxxxxxxx; Dave Page
Subject: Re: problem with PG install script on Windows

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.linkedin.com/in/asheshvashi



On Tue, Oct 12, 2010 at 11:56 PM, Igor Neyman <ineyman@xxxxxxxxxxxxxx> 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. _vbscript_ assumes that service is started (without actually checking it's status) and proceeds trying to connect to PG (while running next installation _vbscript_ - 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 _vbscript_ing experience, so please correct me if my code modification is wrong.
 
Regards,
Igor Neyman
 
 

[I.N.] Hello Ashesh,
 
Could you tell, when this fix will get into EnterpriseDB installer, and it'll be possible to download it?
 
Regards,
Igor Neyman
 

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux