Linux Run Level Knowledge (entry level)

Source: Internet
Author: User

1. Linux Boot sequence

Borrow an on-line image of the boot sequence, clear display boot sequence

650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M02/98/CA/wKiom1lAqfehwysHAAAX-C54dW0110.png "title=" Linux boot order. png "alt=" Wkiom1laqfehwyshaaax-c54dw0110.png "/>

2. Linux operating level

RunLevel: Different levels of service start at different level.

0-6:7 levels.

0: Indicates halt, shutdown

1: Single user mode, direct login to admin, no password required.

2: Multiuser mode, Multi User mode,no NFS. NFS is not enabled.

3: Normal multi-user mode, multi user mode, text mode.

4:reserved, retention level, not previously defined.

5: Normal multi-user mode, multi user mode,graphic mode, graphics mode.

6: Indicates reboot, reboot.

The default level, controlled by the Inittab file. The default runlevel is defined in Inittab, which is the first configuration file to be read by running Init after kernel loading is complete.

These 7 runlevel, by default, correspond to the 7 rc#.d under/etc/rc.d/in the Linux directory structure

650) this.width=650; "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ("/e/u261/lang/zh-cn/ Images/localimage.png ") no-repeat center;border:1px solid #ddd;" alt= "Spacer.gif"/>650 "this.width=650;" src= " Https://s3.51cto.com/wyfs02/M01/98/CA/wKioL1lAqjXD4RusAAAtyar3K44286.png "title=" Rc.d.png "alt=" Wkiol1laqjxd4rusaaatyar3k44286.png "/>

Linux start-up all here, with the above boot process sequence, structure at a glance.

3, the switching mechanism of Linux operation level.

In each RC#.D directory, there are script files starting with K and starting with S.

650) this.width=650; "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ("/e/u261/lang/zh-cn/ Images/localimage.png ") no-repeat center;border:1px solid #ddd;" alt= "Spacer.gif"/>650 "this.width=650;" src= " Https://s5.51cto.com/wyfs02/M02/98/CA/wKiom1lAqkazmUFdAACc_PPr8Do210.png "title=" Rc3.d.png "alt=" Wkiom1laqkazmufdaacc_ppr8do210.png "/>

The meaning of the file starting with K is that when the run level is converted to this level, the service will be killed, that is, the service name stop. Accordingly, a script that starts with S is a script that will start when converted to that level.

The performer of the above action is the RC script under/etc/rc.d/, this script can see the Linux operation level conversion mechanism and the Order of action execution.

650) this.width=650; "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ("/e/u261/lang/zh-cn/ Images/localimage.png ") no-repeat center;border:1px solid #ddd;" alt= "Spacer.gif"/>650 "this.width=650;" src= " Https://s4.51cto.com/wyfs02/M01/98/CA/wKioL1lAql6TbLQsAAAxzj7FLgA875.png "title=" Rc.png "alt=" Wkiol1laql6tblqsaaaxzj7flga875.png "/>

After the level switch, the kill script is executed first, and the service that starts with K in the RC#.D directory is closed. Either K or S is followed by a number, and when you execute the for I in/etc/rc$runlevel.d/k* this loop, the script will be sorted from small to large with the number after K, so the shutdown is done from small to large in order, and the start script is the same.



So why is init0 shutdown and init6 a reboot? A comparison of RC0.D and RC6.D is clear.

650) this.width=650; "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ("/e/u261/lang/zh-cn/ Images/localimage.png ") no-repeat center;border:1px solid #ddd;" alt= "Spacer.gif"/>

650) this.width=650; "src=" Https://s5.51cto.com/wyfs02/M02/98/CB/wKiom1lAqoDCUxOuAACiGMbucss925.png "style=" float : none; "title=" Rc0.d "alt=" Wkiom1laqodcuxouaacigmbucss925.png "/>

650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M02/98/CB/wKioL1lAqoHhFhZbAACiWJ0VTwg182.png "style=" float : none; "title=" Rc6.d "alt=" Wkiol1laqohhfhzbaaciwj0vtwg182.png "/>

650) this.width=650; "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ("/e/u261/lang/zh-cn/ Images/localimage.png ") no-repeat center;border:1px solid #ddd;" alt= "Spacer.gif"/>

Although they call the same script, but because the script name is different, so according to the contents of the following/etc/rc.d/init.d/halt script can be known, this is two different actions.

650) this.width=650; "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ("/e/u261/lang/zh-cn/ Images/localimage.png ") no-repeat center;border:1px solid #ddd;" alt= "Spacer.gif"/>650 "this.width=650;" src= " Https://s5.51cto.com/wyfs02/M01/98/CB/wKiom1lAqpbiBNqXAAAiZSxurio517.png "title=" Halt.png "alt=" Wkiom1laqpbibnqxaaaizsxurio517.png "/>

4. Common commands related to Runleve

RunLevel: View the current operating level of the system.

Who-r: View the current operating level of the system.

Init #: Toggles the run level.


Linux Run Level Knowledge (entry 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.