2. shutdown-r now restart immediately (root user use)
3. shutdown-r 10 minutes automatic restart (root user use)
4. shutdown-r 20:35 restart at 20:35 (root user use)
2. Power off
3. shutdown-h now shutdown immediately (root users use)
4. shutdown – H 10 10 minutes after automatic shutdown
Ps: Here are five Linux restart commands. The details are as follows:
Five Restart Commands for Linux
2. Specific Explanation of Five Restart Orders
Under linux, shutdown, halt, reboot and init are commonly used shutdown/restart commands, which can achieve the purpose of restarting 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.
The shutdown command safely shuts down the system. Some users turn off 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 forcing shutdown may lead to data loss of the process, make the system in an unstable state, and even damage hardware devices in some systems. By using the shutdown command before the system shuts down, the system administrator notifies all logged-in users that the system will be shut down. And login instructions are frozen, meaning that new users can no longer log in. It is possible to shut down directly or to delay the shutdown for a certain period of time. It may also be restarted. This is the signal sent by the system by all processes.
It’s decided. This gives programs like VI time to store documents currently being edited, while programs like those dealing with mail and news can leave normally, and so on.
Shutdown performs its job by sending a signal to the init program, requiring it to change runlevel.
Runlevel 0 is used to shut down, runlevel 6 is used to reactivate the reboot system, and runlevel 1 is used to put the system into a state where management can proceed; this is presupposed, assuming there is no – H and no – R parameter to shutdown. To understand what actions have been taken during downtime or reboot, you can see these runlevels in this file / etc / inittab.
Shutdown parameter description:
[-t] Tell init how long to shut down before changing to other runlevels.
[-r] Restart the calculator.
[-k] doesn’t really shut down, just send a warning signal to
[-h] Shut off the power supply [halt].
[-n] Don’t use init, but turn it off on your own. Use of this option is discouraged, and the consequences of this option are often not always what you expect.
[-c] cancel current process cancels the shutdown program currently being executed. So of course this option has no time parameter, but you can enter a message for interpretation, which will be sent to every user.
[-f] ignores fsck when restarting the calculator [reboot].
[-F] Forces fsck when restarting the calculator [reboot].
[-time] Sets the time before shutdown.
2. halt – The simplest shutdown command
In fact, halt is a call to shutdown-h. When halt is executed, the application process is killed, the sync system call is executed, and the kernel stops after the file system write operation is completed.
Description of parameters:
[-n] prevents sync system calls, which are used after the root partition is patched with fsck to prevent the kernel from overwriting the patched superblock with the older version of the superblock.
[-w] is not a real restart or shutdown, it’s just writing
Wtmp [var/log/wtmp] record.
[-d] Does not write a wtmp record [already included in option [-n].
[-f] Forces shutdown or restart without calling shutdown.
Turn off all network interfaces before [-i] shut down [or restart].
[-p] This option is the default. Call poweroff when it shuts down.
Reboot works almost like halt, but it triggers a host reboot, and halt is off. Its parameters are similar to halt.
Init is the ancestor of all processes, its process number is always 1, so sending TERM signal to init will terminate all user processes, daemons, etc. Shutdown uses this mechanism. Init defines eight runlevels, init 0 shuts down and init 1 restarts. There’s a long story about init, and I won’t talk about it here. There are also telinit commands that can change the init’s level of operation. For example, telinit-iS enables the system to enter single-user mode without the information and waiting time when shutdown is used.
Above mentioned are five restart orders of Linux introduced by Xiaobian. I hope they will be helpful to you. If you have any questions, please leave me a message and Xiaobian will reply to you in time. Thank you very much for your support to developpaer.