如何在 Ubuntu 中添加另一个运行级别(级别 7)?
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: invalid runlevel: 7
Ubuntu has 8 run levels (0-6 and S), I want to add the run level 7.
I have done the following:
1.- Created the folder /etc/rc7.d/, which contains some symbolic links to /etc/init.d/
2.- Created the file /etc/event.d/rc7 This is its content:
# 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
I thought that would be enough, but telinit 7 still throws this error: telinit: illegal runlevel: 7
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不确定如何添加它们(从来不需要),但我很确定
/etc/inittab
是您添加运行级别的地方。尽管我必须同意 Zathrus 的观点,即其他运行级别可用但未使用。 在 Debian 上,实际上只使用了 1 和 2。 不过我不确定 Ubuntu 是如何设置的。 不过,如果你有特定的目的,应该是可以做到的。 我只是从来没有必要这样做。
I'm not sure how to add them (never needed to), but I'm pretty sure
/etc/inittab
is where you'd add runlevels.Although I'd have to agree with Zathrus that other runlevels are available but unused. On Debian, only 1 and 2 are used, really. I'm not sure how Ubuntu has it set up, though. However, if you have a specific purpose, it should be possible to do. I've just never had to.
你不能; 运行级别被硬编码到实用程序中。 但为什么需要这样做呢? 运行级别 4 基本上未使用。 虽然这不是最好的主意,但您可以重新调整运行级别 3 或运行级别 5,具体取决于您是否总是/从不使用 X。
请注意,某些 *nix 系统支持 6 个以上的运行级别,但 Linux 不是其中之一。
You cannot; the runlevels are hardcoded into the utilities. But why do you need to? Runlevel 4 is essentially unused. And while it's not the best idea, you could repurpose either runlevel 3 or runlevel 5 depending on if you always/never use X.
Note that some *nix systems have support for more than 6 runlevels, but Linux is not one of them.