postgres, ubuntu how to restart service on startup? get stuck on clustering after instance reboot

On Ubuntu 18.04:

sudo systemctl restart postgresql.service


I guess it would be best to fix the database startup script itself. But as a work around, you can add that line to /etc/rc.local, which is executed about last in init phase.


ENABLE is what you are looking for

USAGE: type this command once and then you are good to go. Your service will start automaticaly at boot up

 sudo systemctl enable postgresql

DISABLE exists as well ofc

Some DOC: freedesktop man systemctl