在 ubuntu 中啟動時停用服務

在 ubuntu 中啟動時停用服務

我在 Ubuntu 上安裝了這些應用程式:

  • nginx

  • php5-fpm

  • mysql伺服器

  • 雷迪斯

這些應用程式在每次電腦開啟時運行。

如何防止這些應用程式在啟動時運行?
因此,這些應用程式僅在我執行“service nginx start”時運行。

答案1

使用:

systemctl disable <service>

如果您不使用 systemd(Ubuntu 14.10 及更早版本),請使用:

update-rc.d -f <service> remove

以下命令將為您提供電腦上所有服務的清單:

service --status-all

您應該能夠在其中找到要停用的服務的名稱。

有關更多詳細信息,請參閱啟用和停用服務很長的答案,請參考此郵政(正如@muru 已經提到的)。

有關更多詳細信息,請參閱此帖子數位海洋手冊頁對於 systemctl.

答案2

另一種方法是安裝 rcconf apt-get install rcconf。從 rcconf 中,您可以啟用/停用 ubuntu/debian 伺服器上安裝的任何服務。

答案3

安裝sysv-rc-conf

apt-get install sysv-rc-conf

然後簡單地列出服務

sysv-rc-conf --list

禁用任何服務,即 nginx

sysv-rc-conf nginx off

欲了解更多信息,請參閱man sysv-rc-conf

相關內容