Runlevel笔记:修订间差异
小无编辑摘要 |
小无编辑摘要 |
||
第1行: | 第1行: | ||
[[Linux inittab和systemctl set-default]] | |||
===简介 === | ===简介 === | ||
'''运行级别'''('''Runlevel''')指的是Unix或者Linux等类Unix操作系统下不同的运行模式。运行级别通常分为 7 等,分别是从 0 到 6 ,但如果必要的话也可以更多。 | '''运行级别'''('''Runlevel''')指的是Unix或者Linux等类Unix操作系统下不同的运行模式。运行级别通常分为 7 等,分别是从 0 到 6 ,但如果必要的话也可以更多。 | ||
第18行: | 第20行: | ||
<blockquote>Generally it is not necessary to alter the scripts in this directory. | <blockquote>Generally it is not necessary to alter the scripts in this directory. | ||
Their purpose is to <b>stop all services</b> and to make the system ready | Their purpose is to <b>stop all services</b> and to make the system ready | ||
for shutdown.</blockquote> | for shutdown.</blockquote> | ||
:3. /etc/rc1.d -----> | :3. /etc/rc1.d -----> | ||
<blockquote>Generally it is not necessary to alter the scripts in this directory. | <blockquote>Generally it is not necessary to alter the scripts in this directory. | ||
Their purpose is to <b>stop all services</b> and thus to put the system in | Their purpose is to <b>stop all services</b> and thus to put the system in | ||
single-user mode.</blockquote> | single-user mode.</blockquote> | ||
:4. /etc/rc<i>2/3/4/5</i>.d -----> | :4. /etc/rc<i>2/3/4/5</i>.d -----> |
2019年12月5日 (四) 12:18的最新版本
Linux inittab和systemctl set-default
简介
运行级别(Runlevel)指的是Unix或者Linux等类Unix操作系统下不同的运行模式。运行级别通常分为 7 等,分别是从 0 到 6 ,但如果必要的话也可以更多。
例如在大多数Linux操作系统下一共有如下7个典型的运行级别:
- 0 停机,关机
- 1 单用户,无网络连接,不运行守护进程,不允许非超级用户登录
- 2 多用户,无网络连接,不运行守护进程
- 3 多用户,正常启动系统
- 4 用户自定义
- 5 多用户,带图形界面
- 6 重启
/etc/init.d 和 /etc/rc*.d 那些事
- 1. /etc/rc*.d ----> The scripts are all symbolic links whose targets are located in /etc/init.d/
- 2. /etc/rc0.d ---->
Generally it is not necessary to alter the scripts in this directory.
Their purpose is to stop all services and to make the system ready
for shutdown.
- 3. /etc/rc1.d ----->
Generally it is not necessary to alter the scripts in this directory.
Their purpose is to stop all services and thus to put the system in
single-user mode.
- 4. /etc/rc2/3/4/5.d ----->
To disable a service in this runlevel, rename its script in this
directory so that the new name begins with a 'K' and a two-digit number, and run 'update-rc.d script defaults' to reorder the scripts according to dependencies.
A warning about the current runlevels being enabled not matching the LSB header in the init.d script will be printed.
To re-enable the service, rename the script back to its original name beginning with 'S' and run update-rc.d again.
- 5. /etc/rc6.d ----->
Generally it is not necessary to alter the scripts in this directory.
Their purpose is to stop all services and to make the system ready for reboot.
- 6. /etc/rcS.d ----->
The scripts in this directory whose names begin with an 'S' are
executed once when booting the system, even when booting directly into single user mode.
To disable a script in this directory, rename it so that it begins with a 'K' and run 'update-rc.d script defaults' to update the order using the script dependencies.