转载地址:https://blog.csdn.net/it1988888/article/details/8051657
系统运行级别有0~6共7个运行级别:
- # Default runlevel. The runlevels used are:
- # 0 - halt (Do NOT set initdefault to this)
- # 1 - Single user mode
- # 2 - Multiuser, without NFS (The same as 3, if you do not have networking)
- # 3 - Full multiuser mode
- # 4 - unused
- # 5 - X11
- # 6 - reboot (Do NOT set initdefault to this)
- #
- id:5:initdefault:
#0 ——停机(不能使用)
#1——单用户模式
#2——多用户模式,但是没有NFS
#3——完全多用户模式
#4——没有使用
#5——图形界面模式
#6——重启模式(不能使用)
id:5:initdefault(运行模式设置)。
那么,init进程就会读取这个系统运行级别设置,然后运行/etc/rc.d/rc脚本。
通过这个脚本,然后进入rcx.d。启动相应的程序。其中rcx.d为/etc/rc.d/rcx.d(x为对应的系统运行级别)
/etc/rc.d/rcx.d/下的文件均为符号链接,最终绝大部分都是都是链接到/etc/rc.d/init.d下面。
到这里,我们可以知道,/etc/rc.d/init.d目录下面的都是开启启动脚本文件,用来启动相应的程序。