1 Preparation before shutdown
1.1 Observing System usage status
· Who online: Who
· Networking Status: Netstat-a
· Program executed in the background: Ps-aux
1.2 Notify online user of shutdown time
· Shutdown +2 "The machine would shutdown" # 2min after shutting down and notifying the online user
2 Shutdown command
2.1 Sync
· Write data that is not written to the hard disk in memory to the hard disk
2.2 Shutdown
· Shutdown now # shut down immediately
· Shutdown +2 # 2 min after shutdown
· Shutdown 10:01 # 10:01 shutdown
· Shutdown +2 "The machine would shutdown" # 2min after shutting down and notifying the online user
2.3 Reboot
· Reboot, add parameter can implement Halt,poweroff
2.4 Halt
A link to reboot, equivalent to Shutdown-h
2.5 Poweroff
A link to reboot, equivalent to halt
3 Execution level
3.1 Classification
· Run Level 0: shutdown
· Run Level 3: Plain text mode
· Run Level 5: With graphical interface mode
· Run Level 6: Restart
3.2 Level switching
· Init 0 # Switch to Level 0, i.e. shutdown
Attached: Shutdown,halt,poweroff difference
Shutdown: To shut down the system, refer to the existing explanation: "The command safely shuts 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 determined by all process (process) receiving the signal (signal) the system arrives at. This allows programs like VI to have time to store documents that are currently being edited, while programs like Mail (mail) and news (news) can normally leave and so on "
And shutdown will execute the/etc/rc0.d/script below, which means RunLevel 0 is executed. The halt will not.
Poweroff: Power off the system
Poweroff is halt's soft link. The halt command is executed. As for the halt command, you can understand this: halt 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.
Address: http://www.centoscn.com/CentOS/2014/0606/3098.html;
CentOS Correct shutdown method