Linux system boot level and order

Source: Internet
Author: User
Tags naming convention

Linux system has 7 runlevel (runlevel)
RunLevel 0: System down state, system default RunLevel cannot be set to 0, otherwise it will not start normally
RunLevel 1: Single User working status, root privilege, for system maintenance, remote login Forbidden
RunLevel 2: Multi-User State (no NFS)
RunLevel 3: Full multiuser State (with NFS), enter console command line mode after login
Run Level 4: System not used, reserved
Run level 5:x11 console, login to GUI mode
RunLevel 6: The system shuts down gracefully and restarts, the default runlevel cannot be set to 6, otherwise it will not start normally

The operating level principle:
1. There are many server scripts under directory/ETC/RC.D/INIT.D, commonly referred to as services (service)
2. There are 7 directories named RCN.D under/ETC/RC.D, corresponding to the 7 RunLevel of the system
3. RCN.D directories are symbolic link files that point to a service script file under the INIT.D directory, with a naming convention of k+nn+ service name or s+nn+ service name, where NN is a two-digit number.
4. The system will enter the corresponding RCN.D directory according to the specified RunLevel, and retrieve the linked files under the directory in the order of file name.
For files starting with K, the system terminates the corresponding service
For files beginning with S, the system will start the corresponding service
The files in the RCN.D are the connections to the files in the INIT.D, the service, and the file is named in the following format: [Ks]numberservicename
K and S begin with the difference between running or not: K does not run, s runs, and then the two digits determine the order of operation.
5. View run levels by: RunLevel
6. Go to other RunLevel by: Init N
7. Also init0 for shutdown, init 6 reboot system
Since the Linux system is now installed in the 5th level, that is, after the system started directly into the graphical interface, rather than in the character mode after logging in with StartX or xinit to start the graphical interface. It is recommended to set the default operating level of the system at level 3rd after the system installation is complete, and then manually enter the STARTX command to start the graphical interface after the character terminal is logged in. You can modify it in the following ways:
Modify the/etc/inittab file with a text editor to
Code:
Id:5:initdefault: This line, modified into
Code:
Id:3:initdefault: After the reboot is saved, the system will start to the character interface by default. The difference between the different run levels is that the system starts with a different service, such as running Level 3 does not start the X graphical interface service by default, and RunLevel 5 is started by default. There is no difference in nature, and it does not matter whether the function is strong or weak between different levels. Users are fully self-sufficient to define default services at different levels. At any run level, the user can use the init command to switch to another runlevel.
--------------------------------------------------------------------------------
Linux Boot sequence:
1. BIOS Self-Test
2. Run the system kernel and detect the hardware
3, the first process of running the system init
4. Init reads the information from the system boot configuration file/etc/inittab
/etc/rc.d/rc.sysinit------System Initialization Script
/etc/rc.d/rcx.d/[ks]*------Configure services based on RunLevel
/etc/rc.d/rc.local---------performing Local special configuration
Other special services---------different operating levels

Linux starts running the INIT program to start the associated program initialization, a concept related to startup is the RunLevel, run level is the operating system currently running level, at different levels of operation can define the startup program belonging to the run level, the system's RunLevel can be specified in the/etc/inittab file, Run-level related run programs by linking to the destination/ETC/RCX.D from the source/ETC/RC.D/INIT.D, where x is the default runlevel for the system, so the default startup script is placed under/ETC/RC.D/INIT.D.

How to get the system started is to run the specified program, according to the fourth step in the boot order, there are two ways.
One way is to configure the service based on the RunLevel.
One way is to perform a local special configuration.
For example, the task at startup is to run the command CVSLOCKD:
Way One:
1. Create a self-launching script/ETC/RC.D/INIT.D/CVSLOCKD with the following content:
#!/bin/bash
/usr/local/bin/cvslockd

The properties of the settings file are executable:
#chmod +X/ETC/RC.D/INIT.D/CVSLOCKD

2. Look at the computer run level and see Id:5:initdefault: In File/etc/inittab, this system has a runlevel of 5.
3. To the/ETC/RC5.D directory, make a soft connection to the executable you want to execute, and in the name of the time to start with the capital letter S, the number after S is the size of the order of execution, the larger the number is executed.
#ln-S/ETC/RC.D/INIT.D/CVSLOCKD/ETC/RC5.D/S100CVSLOCKD
#ln-S/ETC/RC.D/INIT.D/CVSLOCKD/ETC/RC0.D/K20CVSLOCKD

Way two:
Add EXEC/USR/LOCAL/BIN/CVSLOCKD in/etc/rc.d/rc.local
The way is to start cvslockd at the end.

Linux system boot level and order

Related Article

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.