Linux shutdown command details

zhaozj2021-02-16  72

Linux shutdown command detailed from: LinuxAid.com.cn Sword_martin March 24, 2001 22:58 Some commonly used shutdown / restart commands under Linux There are shutdown, halt, reboot, and init, they can achieve the purpose of restarting the system, However, the internal work process of each command is different. Through this paper, I hope you can use a variety of shutdown commands more flexible. The SHUTDOWNSHUTDOWN command securely shuts down the system. Some users will use them directly to turn off the power to shut down Linux, which is very dangerous. Because Linux is different from Windows, there are many processes in the background, so that the mandatory shutdown may cause the process of data loss, so that the system is in an unstable state, and even in some systems will damage the hardware device. And use the shutdown command before the system shutdown, the system administrator will notify all logged in user systems will be turned off. And the login directive will be frozen, that is, the new user can no longer log in. It is possible to shut down directly or delay a certain time. It may also be restarted. This is determined by all the processes [process] will receive the signal sent by the system [Signal]. This allows programs such as VI to store documents currently editing, and procedure like processing mail [Mail] and news [news] can leave normally, etc.. Shutdown executes its work is to send the signal [signal] to the init program, requiring it to change Runlevel. Runlevel 0 is used to stop [HALT], Runlevel 6 is used to reactivate the [reboot] system, and Runlevel 1 is used to allow the system to enter management work; this is preset, assume no -H There is no -r parameter to shutdown. To understand which movements do in the process of stopping [HALT] or replaying [reboot], you can see these Runlevels related information in this file / etc / inittab. Shutdown Parameter Description: [-t] Tell Init to shut down after changing to other Runlevel. [-R] Restart the calculator. [-K] does not really shut down, just send a warning signal to each login [Login]. [-H] Turn off the power after shutting down. [-N] Do not use init, but it is turned off. This option is not encouraged, and the consequences of this option often not always be expected. [-C] CANCEL CURRENT Process Cancel the shutdown program currently executing. So this option has no time parameters, but you can enter a message used to interpret, and this information will be sent to each user. [-F] ignores FSCK when restarting the calculator [Reboot]. [-F] Forcing FSCK when restarting the calculator [Reboot]. [-Time] Set the time before shutdown [shutdown]. 2.Halt ---- The easiest shutdown command actually hald is calling shutdown -h. When HALT is executed, kill the application process, perform the SYNC system call, and the file system will stop the kernel after the write operation is completed. Parameter Description: [-n] Prevents the SYNC system call, which is used to block the buckle with the older version of the hyper block (SuperBlock) after the FSCK is used to block the older version of the hyper block. [-W] is not a real restart or shutdown, just writing WTMP [/ var / log / wtmp] record. [-D] Does not write the WTMP record [already included in the option [-n]]. [-F] No shutdown or restart is forced to call ShutDown. [-I] Turn off all network interfaces before shutting down [or restart]. [-P] This option is the default option. That is to call PowerOff when turning off. 3. The work process of Rebootreboot is almost the same as HALT, but it is triggering the host restart, and HALT is a shutdown. Its parameters are similar to HALT. 4. InitInit 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, etc. Shutdown is using this mechanism. INIT defines 8 run levels (Runlevel), init 0 is shutdown, init 1 is restarted. About INIT can be a long story, here is no longer described.

转载请注明原文地址:https://www.9cbs.com/read-16102.html

New Post(0)