如何启动和停止服务?

use*_*044 66 init.d upstart services

可能的重复:
启用/禁用服务的推荐方法是什么?

除了以下命令之外,是否还有其他命令可以在 ubuntu 中启动停止重启服务。

  1. service --status-all
  2. service <service name> stop
  3. sudosysv-rc-conf

Lan*_*rts 58

您可以使用以下命令:

service <servicename> stop

service <servicename> start

service <servicename> restart
Run Code Online (Sandbox Code Playgroud)

Noteservice --status-all不会停止或启动任何事情,它只是返回一个状态(其中有一些已知的错误)。

如果你有,upstart那么你可以使用这些:

stop <servicename>

start <servicename>

restart <servicename>
Run Code Online (Sandbox Code Playgroud)

  • 后者(使用 upstart)现在是 Ubuntu 中的首选方式。 (11认同)
  • `upstart` 现在已[自 v15 起被 Ubuntu 弃用](https://wiki.ubuntu.com/VividVervet/ReleaseNotes) (6认同)

Kri*_*per 38

这在很大程度上取决于服务。停止启动和重新启动服务的新的首选方法是通过/etc/init.d. 因此,例如,要停止或启动 Apache Webserver,您可以运行

/etc/init.d/apache2 stop

/etc/init.d/apache2 start

许多其他服务也是如此,但可能不是全部。您可以使用该实用程序sysv-rc-conf查看您拥有哪些使用init.d脚本的服务,并以这种方式管理它们。运行它sudo sysv-rc-conf

如果您正在寻找 GUI 应用程序,请尝试启动管理器。安装

apt-get install bum

并从用户界面或终端运行

sudo bum

可以在此处找到用法和文档。