ShutdownShutdown command to safely shut down the system. It is dangerous for some users to turn Linux off using a direct power-off . Because Linux , unlike Windows, runs many processes in the background, forcing a shutdown can cause data loss to the process, leave the system in an unstable state, or even damage the hardware device in some systems. With the shutdown command before the system shuts down , the system administrator notifies all logged-on users that the system will be closed. and the login command is frozen, that is, the new user can no longer log in. It is possible to shut down directly or delay a certain amount of time before shutting down, and it may be possible to restart the computer. This is done by all processes (Process) will receive the signal that the system is delivering (signal determines. This allows programs like VI to have time to store documents that are currently being edited, rather like processing messages (Mail) and News (News) programs can leave normally) and so on.
Shutdown performs its work is to send a signal (signal) to the INIT program, which requires it to change the runlevel. Runlevel 0 is used to shut down (halt),Runlevel 6 is used to reactivate (Reboot) system, while Runlevel 1 is used to get the system into the state that the management work can make; this is a preset, assuming no -H also does not have the -r parameter to shutdown. To understand what's going on during the shutdown (Halt) or re-boot (reboot)), you can see these runlevels-related data in this file/etc/inittab.
Shutdown parameter Description :
[-T] tell init how long it will shut down before changing to another runlevel.
[-R] Restart calculator.
[-K] does not really shut down, just sends a warning signal to each login (login).
[-h] power off after shutdown (Halt).
[-n] do not use init, but to shut down the machine. The use of this option is discouraged, and the consequences of this option are often not always what you expect it to be.
[-c] Cancel current process cancels the shutdown program that is currently executing. So this option certainly does not have a time parameter, but you can enter a message to interpret, and this information will be sent to each user.
[-f] ignores fsck when restarting the calculator (reboot)) .
[-f] forces fsck to restart the calculator (reboot)) .
[-time] Setsthe time before the shutdown (Shutdown)).
HaltHalt is called shutdown-h. when the halt executes, the application process is killed, the sync system is called, and the kernel is stopped after the file system write operation is complete.
Parameter Description :
[-n] prevents the Sync system from being called, it is used after patching the root partition with fsck to prevent the kernel from using the old version of the Super Block (Superblock) overwrite the patched super block.
[-W] is not a real restart or shutdown, just write wtmp(/var/log/wtmp) Records.
[-d] does not write wtmp record (included in option [-n]).
[-f] does not invoke shutdown and forces shutdown or restart.
[-i] before shutting down (or restarting), turn off all network interfaces.
[-p] This option is the default option. is to call Poweroff when shutting down the machine .