Init initialization phase
After the kernel is loaded, the init program is run. After the init process is started, control of the system startup is handed over to the init process;/sbin/init process is the parent process of all processes. After the init process is started, it first reads the configuration file/etc/inittab and performs the following operations:
1. execute the system initialization script (/etc/rc. d/rc. sysinit) to perform basic configuration for the system, and mount the root file system and other file systems in read/write mode. Now the system is basically running, determine the running level and start the corresponding service. 2. determine the running level after startup; 3. run/etc/rc. d/rc. This file defines the order in which the service is started after k s, and the specific service status at each running level is put in/etc/rc. d/rcn. d (n = 0 ~ 6) All files in the directory are linked to/etc/init. d file; 4. key sequence settings; 5. script definition for UPS; 6. start the virtual terminal/sbin/mingetty; 7. run X on runlevel 5.
Configuration File:/etc/inittab; each line defines an action and the corresponding process
Id: runlevels: action: process; id: the identifier of a task. runlevels: the level at which the task is started: under what conditions should this task be started; process: task; (script or program); action: wait until the current level of the task is switched; respawn: once this task is terminated, it will be automatically restarted; initdefault: Set the default running level; at this time, process is omitted; sysinit: set the system initialization method, here it is generally specified/etc/rc. d/rc. sysinit script; K *: the service to be stopped; K ### *. The smaller the priority and number, the closer the service is to be stopped. The dependent service is disabled first, and then the dependent service is disabled; S *: the service to be started; S ### *: priority. The smaller the number, the higher the priority. The dependent service is started first, and the dependent service is started later;
Chkconfig command: control the startup or shutdown status of/etc/init. d/each service script at each level;
View: chkconfig -- list [name] add: chkconfig -- add name Delete: chkconfig -- del name
Modify the specified link type:
Chkconfig [-- level LEVELS] name <on | off | reset> -- level LEVELS: Specifies the level to be controlled. The default value is 2345.
Init command:
Level switch: init #; level view: who-r.
Note: At the normal level, the last service S99local started is not linked to/etc/init. A script under d is linked to/etc/rc. d/rc. local (/etc/rc. local) scripts. Therefore, programs that are inconvenient or do not need to be written as service scripts expect to run automatically upon startup can be directly placed in this script file.
Address: http://www.linuxprobe.com/system-startup-process.html