In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "introduction of Linux shutdown command". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn the introduction of Linux shutdown command.
The commonly used shutdown commands under linux are: shutdown, halt, poweroff, init; restart commands: reboot. The following article mainly introduces some commonly used shutdown commands as well as the differences and specific uses between various shutdown commands.
First of all, let's take a look at some commonly used shutdown commands under linux.
Shutdown command:
1. Halt shuts down immediately 2, poweroff shuts down immediately 3, shutdown-h now shuts down immediately (used by root users) 4, shutdown-h 10 10 minutes later automatic shutdown if the shutdown is set by the shutdown command, you can use the shutdown-c command to cancel the restart
Restart command:
1. Reboot 2, shutdown-r now immediately restart (for root users) 3, shutdown-r 10 automatically restart after 10 minutes (for root users) 4, shutdown-r 20:35 restart at 20:35 (for root users) if the restart is set by the shutdown command, you can cancel the restart with the shutdown-c command
Some common 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.
Linux centos restart command:
1 、 reboot
2. Shutdown-r now restarts immediately (used by root users)
3. Shutdown-r 10 automatically restarts after 10 minutes (used by root users)
4. Shutdown-r restarts at 20:35 at 20:35 (for root users)
If the restart is set up through the shutdown command, you can cancel the restart with the shutdown-c command
Linux centos shutdown command:
1. Halt shuts down immediately
2. Poweroff shuts down immediately
3. Shutdown-h now shuts down immediately (used by root users)
4. Shutdown-h shuts down automatically after 10 minutes.
If the shutdown is set through the shutdown command, you can cancel the restart with the shutdown-c command
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 shut down the phone directly or delay it for a certain amount of time, and it is also possible to restart it. 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. HaltMustWhile-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 init 1 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.
5.reboot restart command
Reboot works in much the same way as halt. However, it causes the host to restart, while halt shuts down. Its parameters are not much different from those of halt.
At this point, I believe you have a deeper understanding of the "introduction of Linux shutdown command". You might as well do it in practice. 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.