problem with PG install script on Windows - Mailing list pgsql-general
From | Igor Neyman |
---|---|
Subject | problem with PG install script on Windows |
Date | |
Msg-id | F4C27E77F7A33E4CA98C19A9DC6722A2069F26DA@EXCHANGE.corp.perceptron.com Whole thread Raw |
Responses |
Re: problem with PG install script on Windows
|
List | pgsql-general |
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
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
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
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
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
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
Failed to install the 'adminpack' module in the 'postgres' database
loadmodules.vbs ran to completion
Script stderr:
Program ended with an error exit code
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 & "'")
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
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 serviceSet 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 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
pgsql-general by date: