72

Ubuntu 16.04.1 LTS I have tried:

sudo update-rc.d -f postgresql remove

and

sudo vim /etc/postgresql/9.5/main/start.conf

then i change the word "auto" to "disabled"

Then i reboot the computer, and when it starts, i login and do:

sudo service --status-all | grep postgresql

Which returns:

[ + ]  postgresql

So it is still starting when the server starts. What is left for me to do? I don't want this service running when the computer starts, only when i manually start it with:

sudo service postgresql start
3

2 Answers 2

188

Use systemctl command to manage postgresql service:

  1. stop service:

    systemctl stop postgresql

  2. start service:

    systemctl start postgresql

  3. show status of service:

    systemctl status postgresql

  4. disable service(not auto-start any more)

    systemctl disable postgresql

  5. enable service postgresql(auto-start)

    systemctl enable postgresql

Sign up to request clarification or add additional context in comments.

4 Comments

The service still auto-starts after a sudo systemctl disable postgresql@10-main. sudo service postgresql@10-main disable doesn't work, either. Perhaps editing /etc/postgresql/10/main/start.conf might do the trick.
I tried disabling it.. but I'm getting a permission denied error.. @g10guang - need to add sudo!
It really helped me out. It works perfectly.
on ubuntu 20.04.5 i needed to edit /etc/postgresql/[VERSION]/main/start.conf and change auto -> disabled
15

Ok. it's fixed thanks to Koen De Groote.

I did:

echo manual | sudo tee /etc/init/postgresql.override

and

sudo systemctl disable postgresql.service

and

sudo systemctl disable postgresql

....I don't know which one of them did it, but its not starting any more... Thank you...

1 Comment

@asdf sudo systemctl disable postgresql this is enough.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.