Test environment: CentOS6.6 x86_64
Accidentally found after deleting/etc/inittab file can still enter the system, I remember the 5 series will pop up a dialog to select the RunLevel. So I studied it a bit.
#之前走了一点弯路, mistakenly think that control is done in the/sbin/init binary program, downloaded the upstart source package, the results did not understand how to read-_-!
#后来发现控制过程在shell脚本里.
#不过也算有一点收获
SRC.RPM Decompression Source Method
Rpm2cpio XXX.src.rpm |CPIO-IVMD
-I extraction
-V Show More information
-M does not change the original file change time
-D cpio will create a directory on its own if needed
In addition, the command after the pipeline if not write will show garbled, don't ask me why I know
Split Line —————————————————————————————————————————
The init systems of RHEL5, RHEL6 and RHEL7 are sysvinit, upstart and SYSTEMD respectively.
For the three differences, please refer to
Http://www.ibm.com/developerworks/cn/linux/1407_liuming_init1/index.html
Http://www.ibm.com/developerworks/cn/linux/1407_liuming_init2/index.html
Http://www.ibm.com/developerworks/cn/linux/1407_liuming_init3/index.html
(Examples of these documents are made in Ubuntu, where details and Rhel may differ.) )
CentOS is a community enterprise version of Red Hat, with a fairly small difference from Rhel. CentOS6.6 also uses upstart
----------------------------------------------------------------------------------------------------------
# rpm-qf/sbin/init
upstart-0.6.5-13.el6_5.3.x86_64
=================================================== ==========
Upstart Sysvinit originally in the/etc/inittab rc.sysinit, RC.D and other configuration split, placed under/etc/init/. /etc/inittab becomes only responsible for controlling the runlevel.
After the system kernel has been loaded, the first process init is executed. Init executes a script that
/etc/init/rcs.conf
content as follows:
8 start on startup 9 10 stop on runlevel 11 12 task 13 14 # Note: there can be no previous Runlevel here, if we have one it ' S bad 15 # information (we enter rc1 not rcs for maintenance).   RUN /ETC/RC.D/RC 16 # without information so that it defaults to previous=n runlevel=S. 17 console output 18 pre-start script 19 for t in $ (cat /proc/cmdline); do 20 case $t in 21 emergency) 22 start rcS-emergency 23 break 24 ;; 25 Esac 26 done 27 end script 28 exec /etc/rc.d/rc.sysinit 29 post-stop script 30 if [ " $UPSTART _events " = " Startup " ]; then 31 [ -f /etc/inittab ] && runlevel=$ (/bin/awk -f ': ' ' $3 == "Initdefault" && $1 !~ "^#"  { PRINT $2 } ' /etc/inittab) 32 [ -z "$runlevel" ] & & runlevel= "3" 33 for t in $ (Cat /proc/cmdline); do 34 case $t in 35 -s|single| S|s) runlevel= "s" ;; 36 [1-9]) runlevel= "$t" ;; 37 esac 38 done 39 exec telinit $runlevel 40 fi 41 end script
and runlevel about 30-32 lines:
30 IF [ "$UPSTART _events" = "startup" ]; Then
[-f/etc/inittab] && runlevel=$ (/bin/awk-f /etc/inittab)
32 [-Z " $runlevel "] & & Runlevel=
#----------------------------------------------- -----------------------------------------------------
30 Rows: If the event that is triggered is "startup", the following is executed.
31 Line:/bin/awk-f ': ' $ = = ' Initdefault && $!~ ' ^# ' {print $} '/etc/inittab means: " :" As the field delimiter, find out/etc/ini Ttab The third field is Initdefault, and it is not a line that begins with "#" (#开头一般为注释), and then extracts the second field.
Even if there is/etc/inittab this file, the value of RunLevel takes the string just extracted.
32 Line: If now RunLevel is empty, let RunLevel take "3". This value can be changed. But it's better to be 3.
so delete Inittab, the second half of the 32nd Line assignment statement takes effect , the last run level is 3.
CentOS6 Run Level