Linux boot sequence: 1. BIOS self-check 2. run the system kernel and check the hardware 3. run the system's first process init4. init reads the information in the system boot configuration file/etc/inittab for initialization/etc/rc. d/rc. sysinit ------... linux startup sequence
Linux startup sequence: 1. BIOS self-check 2. run the system kernel and check the hardware 3. run the system's first process init4. init reads the information in the system boot configuration file/etc/inittab for initialization/etc/rc. d/rc. sysinit ------ system initialization script/etc/rc. d/rcX. d/[KS] * ------ configure the service/etc/rc according to the running level. d/rc. local --------- execute local special configurations other --------- special services of different running levels Linux starts to run the init Program to start initialization of related programs. one concept related to startup is the runtime level, the running level is the current running level of the operating system. at different running levels, you can define the startup program that belongs to the running level. the running level of the system can be specified in the/etc/inittab file, the running-level programs run through the source/etc/rc. d/init. d. link to the destination/etc/rcX. d. Here, X is the default running level of the system. Therefore, the default start script is Under/etc/rc. d/init. d. # The default running level is as follows: #0-stop (do not set initdefault to 0) #1-single-user mode #2-multiple users, but there is no NFS #3-full multi-user mode #4-not used #5-X11 #6-restart (do not set initdefault to 6) # detailed explanation of each running level: 0 indicates that the machine is shut down. 1 is the single-user mode, just like the security mode in Win9x. 2: Multi-user mode, but not supported by NFS. 3 is a complete multi-user mode, which is a standard operation level. 4. Generally, you can use it to do things in some special cases. For example, you can switch to this mode to make some settings when the battery of your laptop is exhausted. 5 is X11, and it enters the X Window System. 6. restart the init 6 server. There are two ways to enable the system to run a specified program at startup: Step 4 in the startup sequence. One way is to configure the service according to the running level. One way is to execute special local configurations. For example, when a task is started, run the command cvslockd: Method 1: 1. create a self-starting script/etc/rc. d/init. d/cvslockd with the following content :#! The attributes of the/bin/bash/usr/local/bin/cvslockd setting file are executable: # chmod + x/etc/rc. d/init. d/cvslockd 2. view the computer running level. in the file/etc/inittab, the system running level is 5. 3. in the/etc/rc5.d Directory, make a soft connection to the executable file you want to execute, and start with the uppercase letter "S" when naming the file, the number size after S indicates the order of execution. the larger the number, the higher the execution order. # Ln-s/etc/rc. d/init. d/cvslockd/etc/rc5.d/S100cvslockd # ln-s/etc/rc. d/init. d/cvslockd/etc/rc0.d/K20cvslockd mode 2: in/etc/rc. d/rc. add exec/usr/local/bin/cvslockd to local. this method starts cvslockd at the end. Method 3: update-rc.d ================================== gorgeous split line ======================== ==== update-rc.d command, it is used to automatically upgrade the System V type initialization script. Simply put, what do you want the System to run during boot initialization, if you want to stop the instance when it is shut down or restarted, you can use it to help you set it. The connection of these scripts is located in/etc/rcn. d/LnName. the script is located in/etc/init. d/Script-name. 1. set a startup item that specifies the startup sequence and the running level: update-rc.d Start 2. set to stop in the specified order at the specified run level: update-rc.d Stop 3. remove the specified startup item from all running levels: update-rc.d-f Remove
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service