Postgres, ubuntu, how to restart the service at startup? get stuck on clustering after instance reload

I have Postgres db 9.1 running on AWS EC2 , with ubuntu 12.04 .

I messed up a lot with the instance (I installed all kinds of postgres XX before I settled on 9.1).

Now, after a month working on this db, I found that if I restart my postgres instance, it does not load correctly, its status says โ€œCluster startโ€. it will last forever until I

 sudo service postgresql restart 

from the terminal, and then it works again.

How to add this line to ubuntu startup so that every time it boots, it will restart this service and hopefully solve my problem?

Also any other solution that could solve this problem.

+47
May 13 '13 at 6:04
source share
2 answers

I think the best way is to fix the start of the database script. But, as work, you can add this line to /etc/rc.local , which is executed for the last time in the init phase.

+7
May 13 '13 at 9:53
source share

On Ubuntu 18.04:

sudo systemctl restart postgresql.service

0
Dec 14 '18 at 13:24
source share



All Articles