2008-09-22 69 views
0

Ubuntu有8个运行级别(0-6和S),我想补充的运行级别7如何在Ubuntu中添加另一个运行级别(级别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

回答

2

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

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

+0

根据Debian的init页面,运行级别最高可达9。我认为Ubuntu也是如此。 – 2008-09-22 03:21:30

0

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

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