Rc. d init. d Linux runtime details

Source: Internet
Author: User

What are the steps required to start Linux? This article describes in detail the roles of different running levels in startup. Linux seems to be a monster for advanced users on the DOS/Win9x/NT platform. No config. sys, no autoexec. bat, and machine configurations with personal characteristics do not know where to start. It should be noted that many people think that Linux is a clone of UNIX, but this statement is unfair to Linux. Linux is more open and powerful than UNIX. We should call it GNU/Linux. When Linux is started, it runs a program called init and starts subsequent tasks, including multi-user environments and networks. So what is the runtime level? Simply put, the running level is the function level currently running in the operating system. This level ranges from 1 to 6 and has different functions. These levels are specified in the/etc/inittab file. This file is the main file found by the INIT program. The first service to run is the files stored in the/etc/rc. d directory. In most Linux releases,/etc/rc. d/init. d is started. These scripts are used by ln commands to connect to the/etc/rc. d/rcN. d directory. (Here N is the running level 0-6) for example/etc/rc. the s10network under D/rc2.d is connected to/etc/rc. d/init. d. Therefore, we can know that the files under rc2.d are related to Operation Level 2. "S" at the beginning of the file indicates that "start" indicates that the service is started, and "10" indicates the order in which the service is started. For example, in the same directory, you can also see the s80postfix file. The order of 80 is after 10, because if the network is not started, starting Postfix does not work. Check/etc/rc. d/rc3.d again. You can see the file s60nfslock, but this file does not exist in the/etc/rc. d/rc2.d directory. NFS uses this file, which is generally used in multi-user environments, so it is stored in the rc3.d directory. In addition, you can see files starting with K in/etc/rc. d/rc2.d, for example,/etc/rc. d/rc2.d/k45named, and K indicates kill. The standard Linux operating level is 3 or 5. If it is 3, the system is in the multi-user State. If it is 5, the X Window System is running. If it is currently 3 or 5, and you reduce the running level to 2, init will execute the k45named script. Different running levels are defined as follows: (refer to/etc/inittab in Red Hat Linux) # The default running level. RHS uses the following levels: #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. Different running levels have different functions and should be set according to different situations. For example, if the root password is lost, you can set the machine startup status to a single user. Enter init =/bin/sh RW at the LILO prompt after startup to enable the machine to enter runtime Level 1 and mount the root file system to read/write. He will skip all system authentication, so that you can use the passwd program to change the root password, and then start to a new running 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.