Linux Server several shutdown commands detailed

Source: Internet
Author: User

Some of the common shutdown/Restart commands in Linux are shutdown, halt, reboot, and Init, all of which can achieve the purpose of restarting the system, but the internal process of each command is different.

1.shutdown
The shutdown command shuts down the system securely. It is very dangerous for some users to turn off Linux by simply breaking the power off. Because Linux differs from windows in that it runs many processes in the background, forcing a shutdown can cause data loss in the process, causing the system to be in an unstable state? Even in some systems, hardware devices are damaged.

and use the Shutdown command before the system shuts down? The system administrator notifies all logged-in users that the system will be closed. And the login command is frozen? That is, the new user can no longer log in. Is it possible to shut down directly or delay a certain amount of time? It may also reboot. This is determined by the signal (signal) that all process (process) will receive the system delivery. This lets programs like VI have time to store documents that are currently being edited, and programs like Mail (mail) and news (news) can leave normal and so on.

Shutdown performs its work by sending signals (signal) to the INIT program? Ask it to change the runlevel. RunLevel 0 is used for downtime (halt)?runlevel 6 is used to reactivate the (reboot) system? and RunLevel 1 is used to allow the system to enter the state of management can be done? This is a preset? Suppose there is no-H and no-r argument to shutdown. What do you want to know about (halt) or rebooting (reboot) during downtime? You can see these runlevels related information in this file/etc/inittab.
Shutdown parameter Description:
[t] before changing to another runlevel? Tell Init how long to shut down.
[-R] to restart the calculator.
[K] does not really shut down? Just send a warning signal to each person who (login).
[-h] shuts down the power (halt) after shutting down the computer.
[-n] do not use init? Instead, you shut down your computer. Do not encourage the use of this option? and the consequences of this option are often not always what you expect. The
[-c] Cancel current process cancels the currently executing shutdown program. So, of course, there is no time parameter for this option, but can you enter a message to explain? And this information will be sent to each user.
[-f] ignores fsck when the calculator (reboot) is restarted.  
       [F] forces fsck when the calculator (reboot) is restarted.
[-time] Sets the time before the shutdown (shutdown).

2.halt----The simplest shutdown command
In fact, halt is called shutdown-h. Halt execution? Kill the application process? Execute Sync system call? The kernel is stopped when the file system write operation completes.
Parameter description:
[-n] Prevent sync system calls? It is used after patching the root partition with fsck to prevent the kernel from overwriting the patched super blocks with the old version of the Super Block (superblock).
[-W] is not a real reboot or shutdown? Just write Wtmp(/var/log/wtmp) records.
[-d] does not write Wtmp records (already included in options [-n]).
[-f] forced shutdown or reboot without invoking shutdown.
[i] turn off all network interfaces before shutting down (or rebooting).
[-p] This option is the default option. is to call Poweroff when shutdown.

3.reboot
Reboot's work process is almost the same as Halt's? But does it trigger a host reboot? And halt is shutdown. Its parameters are not much different from the halt.

4.init
Init is the ancestor of all processes? Its process number is always 1? So sending the term signal to INIT will terminate all user processes, daemons, and so on. Shutdown is the use of this mechanism. Init defines 8 run levels (runlevel), Init 0 is shutdown? Init 1 restarts. About Init can be long-winded? Here's no longer a narrative. Is there a telinit command that can change the running level of init? For example? Telinit-is allows the system to enter Single-user mode and does not have the information and latency to use shutdown

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.