In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article shows you how to use the halt command in the linux system, the content is concise and easy to understand, it will definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.
Name: halt
Permissions: system administrator
Usage: halt [- n] [- w] [- d] [- f] [- I] [- p]
Note: if the runlevel of the system is 0 or 6, shut down the system, otherwise replace it with the shutdown instruction (plus the-h parameter)
Parameters:
-n: do not write the memory data back to the hard disk before shutting down
-W: it doesn't really turn off, just write the record in / var/log/wtmp file.
-d: do not write records to / var/log/wtmp file (- n this parameter contains-d)-f: force shutdown, do not call the command shutdown
-I: stop all network-related devices before shutting down
-p: turn off the power supply (poweroff) by the way when you turn it off
Example:
Halt-p power off after shutting down the system.
Halt-d shuts down the system without leaving a record.
Common shutdown commands for linux and their differences:
Some commonly used shutdown / restart commands under linux are shutdown, halt, reboot, and init, which can restart the system, but the internal working process of each command is different. Through the introduction of this article, I hope you can use various shutdown commands more flexibly.
1.shutdown
The shutdown command shuts down the system safely.
Some users will turn off the linux by directly disconnecting the power supply, which is very dangerous. Because linux is different from windows, there are many processes running in the background, so forced shutdown may lead to data loss of processes, make the system in an unstable state, and even damage hardware devices in some systems.
Using the shutdown command before the system shuts down, the system administrator will inform all logged-in users that the system is going to shut down. And the login instruction is frozen, meaning that new users can no longer log in. It is possible to turn off the phone directly or delay it for a certain time, and it may be heavy.
Open. This is determined by the fact that all processes (process) receive a signal (signal) delivered by the system. This gives programs like vi time to store documents that are currently being edited, while programs like mail and news can leave normally, and so on.
Shutdown performs its job is to send a signal to the init program, asking it to change the runlevel. Runlevel 0 is used to halt, runlevel 6 is used to reactivate the system, and runlevel 1 is used to put the system into a state where administrative work can be done; this is preset, assuming that there is no-h and no-r parameter to shutdown. To find out what actions are taken during halt or reboot, you can see these runlevels-related materials in this file / etc/inittab.
Shutdown parameter description:
[- t] before changing to another runlevel, tell init how long it will take to shut down.
[- r] restart the calculator.
[- k] doesn't really turn it off, it just sends a warning signal to each login.
[- h] turn off the power supply (halt) after shutdown.
[- n] instead of init, turn off the phone yourself. The use of this option is discouraged, and the consequences of this option are not always what you expect.
[- c] cancel current process cancels the currently executing shutdown program. So of course there is no time parameter for this option, but you can enter a message for interpretation, and this information will be sent to each user.
[- f] ignore fsck when restarting the calculator (reboot).
[- F] forces fsck when restarting the calculator (reboot).
[- time] sets the time before shutdown (shutdown).
2.haltmuri-the simplest shutdown command
Halt is actually a call to shutdown-h. When halt executes, it kills the application process, executes the sync system call, and stops the kernel after the file system write operation is complete.
Parameter description:
[- n] prevents sync system calls, which are used after patching the root partition with fsck to prevent the kernel from overwriting the patched super block with an older version of the superblock.
[- w] is not really rebooting or shutting down, just writing wtmp (/ var/log/wtmp) records.
[- d] do not write wtmp records (already included in the option [- n]).
[- f] forced shutdown or restart without calling shutdown.
[- I] turn off all network interfaces before shutting down (or rebooting).
[- p] this option is the default. It is to call poweroff when the computer is turned off.
3.reboot
Reboot works much like halt, except that it causes the host to restart and halt shuts down. Its parameters are not much different from those of halt.
4.init
Init is the ancestor of all processes, and its process number is always 1, so sending TERM signals to init terminates all user processes, daemons, and so on. Shutdown uses this mechanism. Init defines eight runlevels (runlevel), with init 0 as shutdown and init1 as restart. Init can be a long speech, so I won't talk about it here. There are also telinit commands that can change the running level of init, for example, telinit-iS allows the system to enter single-user mode without getting the information and wait time when using shutdown.
The above is how to use the halt command in the linux system. Have you learned the knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.
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.