In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
This article will explain in detail about the operation mode of linux runlevel, the content of the article is of high quality, so the editor will share it with you for reference. I hope you will have a certain understanding of the relevant knowledge after reading this article.
The linux operating system needs to go through several different stages from startup to boot, which is called runlevel. Similarly, when the linux operating system shuts down, it also goes through several different runlevel. Here we are going to introduce runlevel in detail and show you some tips to avoid unnecessary restarts of your linux system.
Runlevel can be thought of as the state of the system. Figuratively, you can think of runlevel as a bit like Normal,safemode and Command prompt only in Microsoft's windows operating system. Entering each runlevel requires starting or shutting down the corresponding series of services (services), which are placed in the directory / etc/rc.d/rc?.d/ or / etc/rc?.d (?) in the form of initialization scripts. Represents the corresponding serial number of runlevel).
In most linux distributions, there are usually 8 runlevel
Runlevel System State
0 Halt the system
1 Single user mode
2 Basic multi user mode
3 Multi user mode
5 Multi user mode with GUI
6 Reboot the system
S, s Single user mode
Most desktop linux system default runlevel is 5, the user login is the image interface, while most 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 very rarely used, runlevel s and S is not directly for users to use, but used to prepare for Single user mode.
The advantage of linux's running mode over windows's startup mode is that you can use .init tools to convert your current runlevel when the system is idle. In addition, when you shut down or start the linux system, you have unwittingly converted your runlevel, the system shutdown process needs to call runlevel (0 or 6) to shut down all running processes.
Show current operation mode
When you get started, you may be curious about the previous and current modes of operation, and the runlevel command can be used to display this information:
$/ sbin/runlevel
3 5
The output of the runlevel command shows that the initial operation mode is 3, while the current operation mode is 5.
Change the operation mode
To convert the running mode, use the telinit command (root user):
$/ sbin/telinit
In general, the purpose of changing the running mode is to restart some application processes, such as XFree86, changing the running mode from 5 to 3 will terminate XFree86 and all related processes, and then switch the running mode to 5primeXFree86 to start very cleanly. Before you do this, make sure that all your work under XFree86 has been saved, using root users:
$/ sbin/telinit 3
$/ sbin/telinit 5
After typing the command, your screen may display some information about the start or stop of the service.
Add startup service to run mode
To add a startup service to a running mode, first create a new startup script for the service, and then place it in / etc/rc.d/init.d or / etc/init.d/ (depending on your version of linux). To associate the startup script with the running mode, you need to create a symbolic link under the run mode directory and the startup script under / etc/rc.d/init.d/ The file name is usually prefixed with the number SXX,XX, which is used to control the order in which services are started in this mode of operation. The execution order of the script is in ascending order of number size, that is, the smaller the number is, the more it is executed first. Here is an example of adding startup service to the run mode:
$cp myservice / etc/rc.d/init.d/
$ln-s / etc/rc.d/init.d/myservice / etc/rc3.d/S99myservice
In this way, the next time you start with runlevel 3, myservice will start automatically.
Start with a runlevel
You can make your own runlevel to enter during startup. If your system uses lilo, the corresponding part of the startup command will be:
LILO: linux 5
If you are using GRUB, you can press and hold the e key to enter the setting mode at startup, and the corresponding location is displayed as follows:
Kernel / vmlinuz ro root=/dev/hda1 5
About the operation mode of linux runlevel is shared here, I hope that the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.
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.