|
shutdown -h now shuts down immediately shutdown -r now restarts immediately
Linux command: shutdown
Function description: system shutdown command. Syntax: shutdown [-efFhknr][-t seconds][time][warning message] Note: The shutdown command can close all programs and restart or shut down according to the user's needs.
Parameters: -c When executing the "shutdown -h 11:50" command, simply press the + key to interrupt the shutdown command. -f fsck (disk maintenance) is not performed on restart. -F Execute fsck on restart. -h Shut down the system. -k just sends the message to all users, but doesn't actually shut down. -n does not call the init program to shut down, but shutdown does it itself. -r shutdown and then restart. -t<秒数> How many seconds is there a delay between sending a warning message and deleting a message. [Time] Set how long to execute the shutdown command. [Warning message] Information to be transmitted to all logged-in users.
reboot fast reboot (skip the sync process, i.e. synchronize)
Startup level (0~6), located in /etc/inittab: Detailed explanation of the individual operating levels: 0 is a shutdown, the machine is shut down. (Never set to this level) 1 is single-user mode, similar to safe mode under Win9x. 2 is a multi-user mode, but there is no NFS support. 3 is a complete multi-user mode, which is the standard operating level. 4 Generally not, it can be used to do some things in some special cases. For example, when your laptop's battery runs out, you can switch to this mode to make some settings. 5 is X11, which has entered the X Window system. 6 For restart, running init 6 will restart the machine. (Never set to this level)
The difference between shutdown, Halt, init, and reboot: When the shutdown call is called, a signal is sent to the init program to change the runlevel, which is determined by the parameters (shutdown or restart).
halt and reboot are both links to a certain command of shutdown, halt is equivalent to shutdown -h now, that is, close; reboot is equivalent to shutdown -r now, which restarts the system.
As the first program of the Linux system, Init has multiple runlevels, such as 0-shutdown 1-single-user mode 3-character interface 5-graphical interface 6-restart, so using Init for shutdown or restart operations is similar to shutdown, and more direct than shutdown (no need to send signals).
|