Linux shutdown, reboot, halt, init)

Source: Internet
Author: User

Linux shutdown, reboot, halt, init)

Command Overview

Shutdown, poweroff, reboot, halt, and init can all be shut down for general usage.

/Sbin/halt [-n] [-w] [-d] [-f] [-I] [-p] [-h]
/Sbin/reboot [-n] [-w] [-d] [-f] [-I]
/Sbin/poweroff [-n] [-w] [-d] [-f] [-I] [-h]

[Root @ linux ~] $ Reboot -- h
Usage: reboot [-n] [-w] [-d] [-f] [-h] [-I]
-N: not synchronized before stopping the system
-W: Write only the wtmp reboot record and exit.
-D: Do not write the wtmp record
-F: forced shutdown or restart
-H: Keep the hard disk in standalone Mode
-I: Disable all network interfaces.

Shutdown Process

1. Refresh the hard disk cache:
2. Record restart events: (/var/run/utmp,/var/log/wtmp)
3. Kill all processes:
4. Restart the machine:

Shutdown example

# Shutdown-h now # shutdown immediately
# Shutdown-h 02:30 'halt' # Shut Down at. Pay attention to the local time.
# Halt-p # immediate shutdown
# Init 0 # immediately switch the system running level to 0, that is, shutdown
# Shutdown now # Switch to single-user mode (when no option is added)

Restart example

# Shutdown-k now 'reboot' # send a warning message, but it does not actually shut down.
# Shutdown-t5-r now # restart immediately, but the delay between the warning and the deletion process is 5 seconds.
# Init 6 # immediately switch the system running level to 6, that is, restart
# Shutdown-r + 10 'reboot' # restart after 10 minutes
# Shutdown-c # cancel the previous shutdown command
# Shutdown-r now # restart immediately

Shutdown preparation

Linux is no better than Windows. If it cannot be shut down normally, it may cause file system damage because it is too late to write data back to a file. Therefore, pay attention to the following before shutdown:

1. Observe the system status

Run the "who" command to view online users and use the "netstat-a" command to view online network status. Run the "ps aux" command to view background programs.

2. Notify online users # shutdown-k now 'System will reboot in 30 minutes! '

3. Use the correct command # first, determine whether to shut down or restart, and pay attention to parameters.

4. Pay attention to data synchronization # Use sync data synchronization to write data to Disks

Other Instructions

1. View restart records

# Last reboot

2. Remotely start the machine

# Ssh root @ server/sbin/reboot
# Ssh root@192.168.0.1/sbin/shutdown-r now

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.