[Study Notes-Linux] Correct shutdown method in Linux

Source: Internet
Author: User
Correct shutdown method in Linux Table of Contents
  • 1. Prepare for shutdown

    • 1.1 observe the system Usage Status
    • 1.2 notify online users of Shutdown Time
  • 2 shutdown command
    • 2.1 sync
    • 2.2 Shutdown
    • 2.3 reboot
    • 2.4 halt
    • 2.5 poweroff
  • 3. execution level
    • 3.1 Classification
    • 3.2 Level Switch
1. Prepare 1.1 before shutdown to observe the system Usage Status
  • Who is online: WHO
  • Networking status: netstat-
  • Programs executed in the background: PS-Aux
1.2 notify online users of Shutdown Time
  • Shutdown + 2 "the machine will shutdown" # shut down after 2 minutes, and notify the online user
2 shutdown command 2.1 sync
  • Write Data not written to hard disk in memory to Hard Disk
2.2 Shutdown
  • Shutdown now # shut down immediately
  • Shutdown + 2 # shutdown in 2 minutes
  • Shutdown # shutdown
  • Shutdown + 2 "the machine will shutdown" # shut down after 2 minutes, and notify the online user
2.3 reboot
  • Restart. After parameters are added, halt and poweroff can be implemented.
2.4 halt points to the reboot link, which is equivalent to the shutdown-H 2.5 poweroff point to the reboot link, which is equivalent to the halt3 execution level of 3.1 levels
  • Run level 0: Shutdown
  • Run level 3: plain text mode
  • Run level 5: graphic interface mode
  • Run level 6: restart
3.2 Level Switch
  • Init 0 # Switch to level 0, that is, shutdown
Appendix: differences between shutdown, halt, and poweroff
Shutdown: Shut down the system. Refer to the existing explanation: "The command safely shuts down the system. It is very dangerous for some users to disable Linux by directly disconnecting the power supply. Different from windows, Linux runs many processes in the background, therefore, force shutdown may lead to data loss in the process, making the system unstable, or even damaging hardware in some systems. When the shutdown command is used before the system is shut down, the system administrator notifies all logged-on users that the system will be shut down. The LOGIN command is frozen, meaning that new users cannot log on again. It is possible to shut down directly or wait for a certain period of time to restart. This is determined by the signal that all processes receive from the system [Signal. This allows programs like VI to have time to store the files being edited, while programs like mail and news can leave normally. "shutdown will run the script in/etc/rc0.d, that is to say, the runlevel 0 script will be executed. Halt does not. Poweroff: turning off the system power. poweroff is just the soft link of halt. The halt command is executed. The halt command can be understood as follows: Halt calls shutdown-H. When halt is executed, the application process is killed and the sync system call is executed. After the file system write operation is completed, the kernel is stopped.
Source: http://zhidao.baidu.com/question/477827584.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.