For a while i have my db running on a command window because im not figuring out how to run it as a windows service.
Since i have the zip file version downloaded. how can i register the pg_ctl command as a windows service?
By the way, im using the following line to start the server:
"D:/Program Files/PostgreSQL/9.0.4/bin/pg_ctl.exe" -D "D:/Program Files/PostgreSQL/9.0.4/db_data" -l logfile start
Thanks in advance.
Use the
registerparameter for thepg_ctlprogram.The data directory should not be stored in
Program Files, the location of%ProgramData%is e.g. a good choice.In newer versions of Postgres, a separate Windows account is no longer necessary, so the following is also sufficient
Details are in the manual: http://www.postgresql.org/docs/current/static/app-pg-ctl.html
You need to make sure the directory
D:/Program Files/PostgreSQL/9.0.4/db_datahas the correct privileges for the windows user you specify with the-Uflag.Btw: it is a bad idea to store program data in
Program Files. You should move the data directory somewhere outside ofProgram FilesbecauseProgram Filesis usually highly restricted for regular users – with a very good reason.