【问题标题】:How do I add another run level (level 7) in Ubuntu?如何在 Ubuntu 中添加另一个运行级别(级别 7)?
【发布时间】:2008-09-22 11:24:12
【问题描述】:

Ubuntu 有 8 个运行级别(0-6 和 S),我想添加运行级别 7。

我做了以下事情:

1.- 创建文件夹 /etc/rc7.d/,其中包含一些指向 /etc/init.d/

的符号链接

2.- 创建文件 /etc/event.d/rc7 这是它的内容:

# rc7 - runlevel 7 compatibility
#
# This task runs the old sysv-rc runlevel 7 ("multi-user") scripts.  It
# is usually started by the telinit compatibility wrapper.

start on runlevel 7

stop on runlevel [!7]

console output
script
    set $(runlevel --set 7 || true)
    if [ "$1" != "unknown" ]; then
        PREVLEVEL=$1
        RUNLEVEL=$2
        export PREVLEVEL RUNLEVEL
    fi

    exec /etc/init.d/rc 7
end script

我认为这就足够了,但是 telinit 7 仍然抛出这个错误:telinit: 非法运行级别:7

【问题讨论】:

    标签: ubuntu upstart runlevel


    【解决方案1】:

    你不能;运行级别被硬编码到实用程序中。但你为什么需要?运行级别 4 基本上未使用。虽然这不是最好的主意,但您可以根据您是否总是/从不使用 X 来重新调整运行级别 3 或运行级别 5。

    请注意,某些 *nix 系统支持超过 6 个运行级别,但 Linux 不是其中之一。

    【讨论】:

    • 根据 Debian 的初始化页面,最高 9 的运行级别是有效的。我认为 Ubuntu 也是如此。
    【解决方案2】:

    我不确定如何添加它们(从不需要),但我很确定 /etc/inittab 是您要添加运行级别的地方。

    虽然我必须同意 Zathrus 的观点,即其他运行级别可用但未使用。在 Debian 上,真的只使用了 1 和 2。不过,我不确定 Ubuntu 是如何设置的。但是,如果您有特定的目的,应该可以做到。我从来不需要。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-09-16
      • 1970-01-01
      • 1970-01-01
      • 2022-01-08
      • 1970-01-01
      • 2013-01-22
      • 1970-01-01
      相关资源
      最近更新 更多