在 ubuntu 启动时停止 postgresql

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/41528530/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 02:29:02  来源:igfitidea点击:

Stopping postgresql from starting on ubuntu startup

linuxpostgresqlubuntuservice

提问by asdf

Ubuntu 16.04.1 LTS I have tried:

我尝试过的 Ubuntu 16.04.1 LTS:

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

回答by g10guang

Use systemctl command to manage postgresql service:

使用 systemctl 命令管理 postgresql 服务:

  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

  1. 停止服务:

    systemctl stop postgresql

  2. 启动服务:

    systemctl start postgresql

  3. 显示服务状态:

    systemctl status postgresql

  4. 禁用服务(不再自动启动)

    systemctl disable postgresql

  5. 启用服务 postgresql(自动启动)

    systemctl enable postgresql

回答by asdf

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

行。由于 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...

....我不知道是他们中的哪一个做的,但它不再开始了...谢谢...