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.
I find the answer.
that's easy.
only need to script it in the cmd.exe
it will register the "postgreSQL" service to the "services.msc".
then execute services.msc and enable it.
it's done !!!