Linux RunLevel Run Level

Source: Internet
Author: User
Tags naming convention

RunLevel can be thought of as a system state, image a little, you can think runlevel a bit like Normal,safemode in Microsoft's Windows operating system, and command prompt only.

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
s, s single user mode


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
5. View run levels by: RunLevel
6. Go to other RunLevel by: Init N
7. Also init0 for shutdown, init 6 reboot system

To join the startup service in run mode

To add a startup service to a run mode, first create a new service startup script, and then put it in/ETC/RC.D/INIT.D or/etc/init.d/(depending on your Linux version) to associate the startup script with the run mode. You need this run mode directory to create a symbolic link with the startup script under/etc/rc.d/init.d/, the filename prefix is usually sxx,xx, which is used to control the boot order of the service in this run mode. The order in which the scripts are executed is performed according to the number size, that is, the smaller the number the first, the following is a specific example of adding a startup service in run mode:
$ CP myservice/etc/rc.d/init.d/
$ ln-s/etc/rc.d/init.d/myservice/etc/rc3.d/s99myservice
This way, the next time you start with RunLevel 3, the MyService will start automatically.

Attention:

Most of the desktop Linux system default RunLevel is 5, the user login is the graphical interface, and most of the server version of the Linux system default RunLevel is 3, the user login is the character interface, RunLevel 1 and 2 In addition to debugging is rarely used, runlevel s and s are not intended to be used directly by the user, but are used to prepare for single user mode.

Linux RunLevel Run Level

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.