If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > PostgreSQL > Custom action to call a batch file to start postgres server

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-06-11, 03:05
shilpa24 shilpa24 is offline
Registered User
 
Join Date: Apr 2011
Posts: 14
Custom action to call a batch file to start postgres server

Hi,
I am trying to run a batch file automatically after the installation of my project setup. i had create a setup project and add my batch file at application, commands written in batch file is as follows
@ECHO ON
@SET PATH="%CD%\bin";%PATH%
@SET PGDATA=%CD%\data
@SET PGDATABASE=postgres
@SET PGUSER=postgres
@SET PGPORT=5432
@sET PGLOCALEDIR=%CD%\share\locale
%CD%\bin\initdb -D %CD%/data
%CD%\bin\pg_ctl -D %CD%/data -l logfile start

added a custom action install and commit and write a code in installer class like this
Public Overrides Sub Install(ByVal stateSaver As IDictionary)
MyBase.Install(stateSaver)
Dim dir As String = MyBase.Context.Parameters("dir").ToString()
'Change this string to the bat file name
Dim batFileName As String = "postgresql.bat"
'Execute the bat file.
System.Diagnostics.Process.Start(dir & batFileName)
End Sub

Public Overrides Sub Commit(ByVal savedState As IDictionary)
MyBase.Commit(savedState)
Dim dir As String = MyBase.Context.Parameters("dir").ToString()
'Change this string to the bat file name
Dim batFileName As String = "postgresql.bat"
System.Diagnostics.Process.Start(dir & batFileName)
End Sub

but problem is that during the installation process it only launches the black screen ( command screen ) for a while but doesn't execute the command written in batch file.

When this batch file is executed by double click, it works pefectly but from a setup custom action it is not working.

is i m doing the correct process or is ther some other way to run this batch file from custom action
Please help...its urgent
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On