Home > System Tutorial > LINUX > body text

Example: Example of using the shutdown command to shut down CentOS

PHPz
Release: 2024-01-01 10:50:24
forward
543 people have browsed it

Example: Example of using the shutdown command to shut down CentOS

After executing the command shutdown -h 10 'System will shutdown in 10 minitus, please save your file!!!', the system tells everyone that this machine will shut down in ten minutes! And the information will be displayed repeatedly on the user's screen! Within 10 minutes, the system administrator can enter shutdown -c to cancel this shutdown command. As shown below

Example: Example of using the shutdown command to shut down CentOS

If you do not add any parameters when executing the shutdown command, after executing the shutdown command directly, the system will shut down after 1 minute by default!

shutdown -h now Shut down immediately, equivalent to shutdown -h 0

shutdown -h 23:00 The system shuts down at 23:00. If this command is executed at 23:00, the system will shut down at 23:00 the next day

shutdown -h 10 The system will automatically shut down after ten minutes

shutdown -r now The system will restart immediately

shutdown -r 10 'Warning!!! The system will reboot in 10 minitues' The system will reboot in ten minutes and display the following warning information to all logging in users

The reboot command can play the same role as shutdown -r. It is recommended to execute the data writing command sync several times before executing the reboot command to ensure that the data is written to the disk synchronously.

Example: Example of using the shutdown command to shut down CentOS

The difference between shutdown commands halt, poweroff and shutdown

The shutdown command sends a signal to the init program, asking it to change the runlevel runlevel to 0. Init 0 will call halt or poweroff after writing data to the disk and other operations. On a system without ACPI management, Halt just shuts down the operating system, and the host is still in the power-on state. You need to manually press the power button to power off, while Poweroff will send a power-off signal to ACPI. In CentOS 7, systemd is used for service management. There is no difference between these three commands, because halt, poweroff, and shutdown are all symbolic links to /bin/systemctl, as shown in the figure below. Therefore, you only need to choose one of the commands according to your own usage habits.

Example: Example of using the shutdown command to shut down CentOS

The above is the detailed content of Example: Example of using the shutdown command to shut down CentOS. For more information, please follow other related articles on the PHP Chinese website!

source:linuxprobe.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template