For faster navigation, this Iframe is preloading the Wikiwand page for 运行级别.

运行级别

运行级别Runlevel)指的是Unix或者Linux等类Unix操作系统下不同的运行模式。运行级别通常分为7等,分别是从0到6,但如果必要的话也可以更多。

例如在大多数Linux操作系统下一共有如下7个典型的运行级别:

  • 0 停机,关机
  • 1 单用户,无网络连接,不运行守护进程,不允许非超级用户登录
  • 2 多用户,无网络连接,不运行守护进程
  • 3 多用户,正常启动系统
  • 4 用户自定义
  • 5 多用户,带图形界面
  • 6 重启

Debian Linux中,2-5这四个运行级别都集中在级别2上。这个级别也是系统预设的正常运行级别。

运行级别定义了机器启动后的状态。

在全新的Linux systemd中已经使用target代替Runlevel,如multi-user.target相当于init 3,graphical.target相当于init 5,但是SystemD仍然兼容运行级别(Runlevel)。目前绝大多数发行版已采用systemd代替UNIX System V

对应的文件路径

在Debian Linux中,下列路径对应不同的运行级别。当系统启动时,通过其中的脚本文件来启动相应的服务。

  • /etc/rc0.d Run level 0
  • /etc/rc1.d Run level 1
  • /etc/rc2.d Run level 2
  • /etc/rc3.d Run level 3
  • /etc/rc4.d Run level 4
  • /etc/rc5.d Run level 5
  • /etc/rc6.d Run level 6

如何添加服务到不同的运行级别或者取消服务的自动启动

使用 chkconfig 命令来配置服务。

 1)chkconfig --add camsd 将服务添加到服务列表中,可以使用service camsd start 来启动服务
 2)chkconfig --del camsd 将服务删除出服务列表

设置服务自动运行;

 1) chkconfig --level 35 camsd on 使camsd服务在运行级别3和运行级别5自动运行。
 2) chkconfig --level 35 camsd off 使camsd服务在运行级别3和运行级别5不再自动运行。

查看服务的自启动状态;

 chkconfig --list camsd

参见

Systemd

资料出处

{{bottomLinkPreText}} {{bottomLinkText}}
运行级别
Listen to this article

This browser is not supported by Wikiwand :(
Wikiwand requires a browser with modern capabilities in order to provide you with the best reading experience.
Please download and use one of the following browsers:

This article was just edited, click to reload
This article has been deleted on Wikipedia (Why?)

Back to homepage

Please click Add in the dialog above
Please click Allow in the top-left corner,
then click Install Now in the dialog
Please click Open in the download dialog,
then click Install
Please click the "Downloads" icon in the Safari toolbar, open the first download in the list,
then click Install
{{::$root.activation.text}}

Install Wikiwand

Install on Chrome Install on Firefox
Don't forget to rate us

Tell your friends about Wikiwand!

Gmail Facebook Twitter Link

Enjoying Wikiwand?

Tell your friends and spread the love:
Share on Gmail Share on Facebook Share on Twitter Share on Buffer

Our magic isn't perfect

You can help our automatic cover photo selection by reporting an unsuitable photo.

This photo is visually disturbing This photo is not a good choice

Thank you for helping!


Your input will affect cover photo selection, along with input from other users.

X

Get ready for Wikiwand 2.0 🎉! the new version arrives on September 1st! Don't want to wait?