Friday, May 31, 2013

Installation Postgres service

The following script will install Postgres as a service in a specific port in Windows. The .bat file should be placed in the same folder as bin folder of Postgres
 @ECHO ON  
 REM The script sets environment variables helpful for PostgreSQL  
 @ECHO "%~dp0"  
 @SET PATH="%~dp0\bin";%PATH%  
 @SET PGDATA=%~dp0\data  
 @SET PGDATABASE=postgres  
 @SET PGUSER=postgres  
 @SET PGPORT=5439  
 @SET PGLOCALEDIR=%~dp0\share\locale  
 "%~dp0\bin\initdb" -U postgres -A trust   
 "%~dp0\bin\pg_ctl" -l logfile register -N Postgres_Service -o "-F -p %PGPORT%"  
 NET START Postgres_Service  

No comments:

Post a Comment