In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "the running level of Linux initialization system". Interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn the running level of the Linux initialization system.
In Linux systems, the run level run level refers to the level of operation and maintenance, which is used to describe the running state of the system that indicates what services are available.
Runlevel 1 is strictly restricted and is used only for system maintenance; at this level, the network connection will be inoperable, but the administrator can log in to the system through a console connection.
Other runlevel systems allow anyone to log in and use, but the services available at different levels are different. This article will explore how to configure the run level, how to interactively change the system run level, and how to modify the services available in that state.
The default operational state of the Linux system is a runlevel used when the system is powered on (unless otherwise instructed), which is usually configured in the / etc/inittab file, which usually reads as follows:
Id:3:initdefault
Some systems, including Debian systems, have a default runlevel of 2 instead of 3 in the above file, and do not even have a / etc/inittab file.
How the runlevel is configured by default depends on the specific release version of the Linux operating system you are running. For example, on some systems, runlevel 2 is multi-user mode and runlevel 3 is multi-user mode and supports NFS (network file system). In other systems, runlevel 2-5 is basically the same, and runlevel 1 is in single-user mode. For example, the Debian system runs at the following level:
0 = downtime 1 = single user (maintenance mode) 2 = multiuser mode 3-5 = same as 2 6 = restart
On Linux systems, runlevel 3 is used to share file systems with other systems, and you can easily start and stop file system sharing only by changing the runlevel of the system. The system changes from runlevel 2 to 3 and the system allows file system sharing, whereas the system does not support file system sharing if it changes from runlevel 3 to 2.
At a run level, which processes the system runs depend on the contents of the directory / etc/rc?.d directory, where? It can be 2, 3, 4, or 5 (corresponding to the corresponding run level).
In the following example (Ubuntu system), since the configuration of these directories is the same, we will see that the contents of the directories corresponding to the above four levels are consistent.
/ etc/rc2.d$ ls README S20smartmontools S50saned S99grub-common S20kerneloops S20speech-dispatcher S70dns-clean S99ondemand S20rsync S20sysstat S70pppd-dns S99rc.local / etc/rc2.d$ cd.. / rc3.d / etc/rc3.d$ ls README S20smartmontools S50saned S99grub-common S20kerneloops S20speech-dispatcher S70dns-clean S99ondemand S20rsync S20sysstat S70pppd-dns S99rc.local / etc/rc3.d$ cd.. / rc4.d / etc / rc4.d$ ls README S20smartmontools S50saned S99grub-common S20kerneloops S20speech-dispatcher S70dns-clean S99ondemand S20rsync S20sysstat S70pppd-dns S99rc.local / etc/rc4.d$ cd.. / rc5.d / etc/rc5.d$ ls README S20smartmontools S50saned S99grub-common S20kerneloops S20speech-dispatcher S70dns-clean S99ondemand S20rsync S20sysstat S70pppd-dns S99rc.local
What are these documents? They all point to the script symbolic links used to start the service in the / etc/init.d directory. The file names of these files are critical because they determine the order in which these script files are executed, for example, the S20 script runs before the S50 script.
$ls-l total 4-rw-r--r-- 1 root root 677 Feb 16 2016 README lrwxrwxrwx 1 root root 20 Aug 30 14:40 S20kerneloops->.. / init.d/kerneloops lrwxrwxrwx 1 root root 15 Aug 30 14:40 S20rsync->.. / init.d/rsync lrwxrwxrwx 1 root root 23 Aug 30 16:10 S20smartmontools->.. / init.d/smartmontools lrwxrwxrwx 1 root root 27 Aug 30 14:40 S20speech-dispatcher->.. / init.d/speech-dispatcher lrwxrwxrwx 1 root root 17 Aug 31 14: 12 S20sysstat->.. / init.d/sysstat lrwxrwxrwx 1 root root 15 Aug 30 14:40 S50saned->.. / init.d/saned lrwxrwxrwx 1 root root 19 Aug 30 14:40 S70dns-clean->.. / init.d/dns-clean lrwxrwxrwx 1 root root 18 Aug 30 14:40 S70pppd-dns->.. / init.d/pppd-dns lrwxrwxrwx 1 root root 21 Aug 30 14:40 S99grub-common->.. / init.d/grub-common lrwxrwxrwx 1 root root 18 Aug 30 14:40 S99ondemand- >.. / init.d/ondemand lrwxrwxrwx 1 root root 18 Aug 30 14:40 S99rc.local->.. / init.d/rc.local
As you might expect, the directory / etc/rc1.d varies depending on the special nature of run level 1. It contains symbolic links that point to a very different set of scripts. Also note that some of these scripts start with K, while others, like other run-level scripts, start with S. This is because some services need to be stopped when the system enters single-user mode. However, when these symbolic links starting with K point to the same file for symbolic links starting with S at other levels, K (kill) indicates that the script will be executed with the parameter that instructs it to stop, not with the parameter started.
/ etc/rc1.d$ ls-l total 4 lrwxrwxrwx 1 root root 20 Aug 30 14:40 K20kerneloops->.. / init.d/kerneloops lrwxrwxrwx 1 root root 15 Aug 30 14:40 K20rsync->.. / init.d/rsync lrwxrwxrwx 1 root root 15 Aug 30 14:40 K20saned->.. / init.d/saned lrwxrwxrwx 1 root root 23 Aug 30 16:10 K20smartmontools->.. / init.d/smartmontools lrwxrwxrwx 1 root root 27 Aug 30 14:40 K20speech-dispatcher->.. / init.d/speech-dispatcher -rw-r--r-- 1 root root 369 Mar 12 2014 README lrwxrwxrwx 1 root root 19 Aug 30 14:40 S30killprocs->.. / init.d/killprocs lrwxrwxrwx 1 root root 19 Aug 30 14:40 S70dns-clean->.. / init.d/dns-clean lrwxrwxrwx 1 root root 18 Aug 30 14:40 S70pppd-dns->.. / init.d/pppd-dns lrwxrwxrwx 1 root root 16 Aug 30 14:40 S90single->.. / init.d/single
You can change the default run level of the system, although this is rarely used. For example, by modifying the / etc/inittab file mentioned earlier, you can configure the default run level of the Debian system to be 3 (instead of 2). Here is an example of this file:
Id:3:initdefault:
Once you have modified and restarted the system, the runlevel command will be displayed as follows:
$runlevelN 3
Alternatively, using the init 3 command, you can also change the running level of the system (and take effect immediately without a restart). The output of the runlevel command is:
$runlevel2 3
Of course, unless you change the symbolic link in the / etc/rc?.d directory of the system's default level so that the system runs under a modified run level by default, you rarely need to change the run level of the system by creating or modifying the / etc/inittab file.
At this point, I believe that everyone on the "Linux initialization system run level" have a deeper understanding, might as well to the actual operation of it! Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.