Linux Startup Process and linux Startup Process
1. Introduction to the System Startup Process
During the startup process, each Linux release version is somewhat different: RHEL 5 is SysVinit, RHEL 6 is Upstart, and RHEL 7 is Systemd. To better illustrate this problem, select RHEL 5. x.
As shown in the flowchart, The RHEL startup process can be roughly divided into the following steps:
POST power-on self-check --> BIOS (Boot Sequence) --> load the MBR on the corresponding Boot (bootloader) --> the main boot settings load its BootLoader --> Kernel initialization --> initrd->/etc/init process load/etc/inittab
Starting from loading BootLoader (Grub in RHEL), the following occurs.
1. through Grub management, read the Kernel file (/boot/vmlinuz), decompress the file to the main memory, and perform the second hardware check using the Kernel function (the first time the POST self-check)
2. load Initial RAM Disk (/boot/initrd) to decompress it into the root directory in the memory. The kernel loads the driver and releases the virtual file system, and mount the actual root directory file system.
3. after the core is loaded and the hardware detection and driver are loaded, the kernel starts the first process/sbin/init and the init process reads the/etc/inittab, in the/etc/inittab, the following actions are roughly specified:
The main function of/sbin/init is to prepare the software running environment, including the host name, network configuration, language processing, file system format, and startup of other services of the system, all actions are performed according to the configuration in the/etc/inittab.
/Etc/rc. d, which contains rc. local, rc. sysinit, init. d, rcX. d (X includes 0-6 corresponding runlevel)
/Etc/rc. d/init. d, which stores the management scripts for startup and shutdown of various system services./etc/init. d is a directory link to it.
/Etc/rc. d/rcX. d. There are some scripts in it. The script name starts with K, which indicates the STOP action, the name starts with S, which indicates the Start action, and the number in the name indicates the execution order, the smaller the number, the more advanced the execution.
/Etc/rcX. d is his directory link, but in fact the file in rcX. d itself is the link file pointing to the script under/etc/rc. d/init. d.
/Etc/rc. d/rc. local has a link file in/etc/rc. local,
The system starts rcX Based on runlevel. d, it will call rc. local script. If you have a script command that you want to start on both 3 and 5, you can add it here, eliminating the need for rc3.d and rc5.d to increase the script startup workload.
Ii. linux auto-start script example
Reference: http://blog.chinaunix.net/uid-26000296-id-3986914.html