2

I have this problem. My OS is Windows server 2012, when I installed. postgresql-10

I open a cmd.exe windows and script it

pg_ctl -D "\My postgres path\10\data" start

Then, server is running. everything is fine.

but when I close the cmd

My postgres service is shutdown. My pg_ctl status show:

pg_ctl: no server running.

So, how can I run postgres like linux OS

sudo service postgres start

Then it will running in the background in spite of I close the vim windows.

Cœur
  • 37,241
  • 25
  • 195
  • 267
Frank Liao
  • 855
  • 1
  • 8
  • 25

1 Answers1

3

I find the answer.

that's easy.

only need to script it in the cmd.exe

pg_ctl register

it will register the "postgreSQL" service to the "services.msc".

then execute services.msc and enable it.

it's done !!!

Frank Liao
  • 855
  • 1
  • 8
  • 25